big update base struktur tahap 1
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Auditable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MenuList extends Model
|
||||
{
|
||||
use Auditable;
|
||||
|
||||
protected $table = 'menu_lists';
|
||||
|
||||
protected $fillable = [
|
||||
'parent_id',
|
||||
'name',
|
||||
'slug',
|
||||
'url',
|
||||
'icon',
|
||||
'component',
|
||||
'sort_order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Relationships
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function menuGroups()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
MenuGroup::class,
|
||||
'menu_group_menus',
|
||||
'menu_id',
|
||||
'menu_group_id'
|
||||
)->withPivot([
|
||||
'can_view',
|
||||
'can_create',
|
||||
'can_update',
|
||||
'can_delete',
|
||||
'can_approve',
|
||||
'can_export',
|
||||
])->withTimestamps();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user