42 lines
828 B
PHP
42 lines
828 B
PHP
<?php
|
|||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace plugin\article\app\model;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
|
||
|
|
class Category extends BaseModel
|
||
|
|
{
|
||
|
|
protected $table = 'article_category';
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'id',
|
||
|
|
'name',
|
||
|
|
'slug',
|
||
|
|
'parent_id',
|
||
|
|
'sort',
|
||
|
|
'enabled',
|
||
|
|
'description',
|
||
|
|
'created_by',
|
||
|
|
'updated_by',
|
||
|
|
'created_at',
|
||
|
|
'updated_at',
|
||
|
|
'deleted_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'parent_id' => 'integer',
|
||
|
|
'sort' => 'integer',
|
||
|
|
'enabled' => 'integer',
|
||
|
|
'created_at' => 'integer',
|
||
|
|
'updated_at' => 'integer',
|
||
|
|
'deleted_at' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function contents(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(Content::class, 'category_id', 'id');
|
||
|
|
}
|
||
|
|
}
|