mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
32 lines
662 B
PHP
32 lines
662 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Scopes\UserOwnedScope;
|
|
use Illuminate\Database\Eloquent\Attributes\ScopedBy;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
|
|
#[ScopedBy(UserOwnedScope::class)]
|
|
class Category extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\CategoryFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'color',
|
|
'user_id',
|
|
];
|
|
|
|
|
|
public function products(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Product::class)
|
|
->withTimestamps();
|
|
}
|
|
}
|
|
|