29 lines
506 B
PHP
29 lines
506 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
|
||
|
|
class Category extends Model
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* The attributes that are mass assignable.
|
||
|
|
*
|
||
|
|
* @var array<int, string>
|
||
|
|
*/
|
||
|
|
protected $fillable = [
|
||
|
|
'name',
|
||
|
|
'slug',
|
||
|
|
'description',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the products for the category.
|
||
|
|
*/
|
||
|
|
public function products(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(Product::class);
|
||
|
|
}
|
||
|
|
}
|