配置功能完善
This commit is contained in:
42
app/Models/HomeModuleItem.php
Normal file
42
app/Models/HomeModuleItem.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class HomeModuleItem extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'home_module_id',
|
||||
'item_key',
|
||||
'title',
|
||||
'subtitle',
|
||||
'image_path',
|
||||
'link_type',
|
||||
'link_target',
|
||||
'sort_order',
|
||||
'enabled',
|
||||
'extra',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'enabled' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
'extra' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function module(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(HomeModule::class, 'home_module_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user