前端打包
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Modules\SystemTool\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
/**
|
||||
@@ -16,17 +17,21 @@ class SysGridNavModel extends Model
|
||||
'status' => 'int',
|
||||
'sort' => 'int',
|
||||
'image_id' => 'int',
|
||||
'link_type' => 'int',
|
||||
'category_id' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'image_id',
|
||||
'link',
|
||||
'link_type',
|
||||
'category_id',
|
||||
'status',
|
||||
'sort',
|
||||
];
|
||||
|
||||
protected $with = ['image'];
|
||||
protected $with = ['image', 'category'];
|
||||
|
||||
/**
|
||||
* 关联图片
|
||||
@@ -37,4 +42,13 @@ class SysGridNavModel extends Model
|
||||
return $this->hasOne(SysFileModel::class, 'id', 'image_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联所属分类(link_type=1 时生效)
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SysCategoryModel::class, 'category_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user