前端打包

This commit is contained in:
liu
2026-08-09 11:15:38 +08:00
parent f67567bdc9
commit 9153c4eead
32 changed files with 1235 additions and 27 deletions
+15 -1
View File
@@ -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 SysCarouselModel extends Model
'status' => 'int',
'sort' => 'int',
'image_id' => 'array',
'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 SysCarouselModel 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');
}
}
@@ -0,0 +1,52 @@
<?php
namespace Modules\SystemTool\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* 首页分类项模型(字段与宫格导航表一致)
*/
class SysCategoryItemModel extends Model
{
protected $table = 'sys_category_item';
protected $casts = [
'category_id' => 'int',
'status' => 'int',
'sort' => 'int',
'image_id' => 'int',
];
protected $fillable = [
'category_id',
'title',
'image_id',
'link',
'status',
'sort',
];
protected $with = ['image'];
/**
* 关联图片
* @return HasOne
*/
public function image(): HasOne
{
return $this->hasOne(SysFileModel::class, 'id', 'image_id');
}
/**
* 关联所属分类
* @return BelongsTo
*/
public function category(): BelongsTo
{
return $this->belongsTo(SysCategoryModel::class, 'category_id', 'id');
}
}
@@ -0,0 +1,37 @@
<?php
namespace Modules\SystemTool\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* 首页分类模型
*/
class SysCategoryModel extends Model
{
protected $table = 'sys_category';
protected $casts = [
'status' => 'int',
'sort' => 'int',
];
protected $fillable = [
'name',
'status',
'sort',
];
/**
* 关联分类项
* @return HasMany
*/
public function categoryItems(): HasMany
{
return $this->hasMany(SysCategoryItemModel::class, 'category_id', 'id')
->orderBy('sort', 'desc')
->orderBy('id', 'desc');
}
}
+15 -1
View File
@@ -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');
}
}