24 lines
601 B
PHP
24 lines
601 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\InteractsWithActivityLog;
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Spatie\Sluggable\Attributes\Sluggable;
|
|
|
|
#[Guarded(['id'])]
|
|
#[Sluggable(from: 'name', to: 'slug')]
|
|
class Category extends Model
|
|
{
|
|
use InteractsWithActivityLog;
|
|
use SoftDeletes;
|
|
|
|
public function products(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Product::class, 'product_categories');
|
|
}
|
|
}
|