feat: add article and production modules
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace plugin\produce\app\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ExceptionSetting extends BaseModel
|
||||
{
|
||||
protected $table = 'produce_exception_setting';
|
||||
|
||||
protected $appends = ['parent_name'];
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'parent_id',
|
||||
'setting_type',
|
||||
'code',
|
||||
'name',
|
||||
'sort',
|
||||
'is_enabled',
|
||||
'remark',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'sort' => 'integer',
|
||||
'is_enabled' => 'integer',
|
||||
'created_by' => 'integer',
|
||||
'updated_by' => 'integer',
|
||||
'created_at' => 'integer',
|
||||
'updated_at' => 'integer',
|
||||
'deleted_at' => 'integer',
|
||||
];
|
||||
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id', 'id')->withTrashed();
|
||||
}
|
||||
|
||||
public function getParentNameAttribute(): string
|
||||
{
|
||||
return (string) ($this->parent?->name ?? '');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user