big update base struktur tahap 1
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MenuGroup extends Model
|
||||
{
|
||||
protected $table = 'menu_groups';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'name',
|
||||
'description',
|
||||
'is_system',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
'is_system' => 'boolean',
|
||||
];
|
||||
|
||||
public function menus()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
MenuList::class,
|
||||
'menu_group_menus',
|
||||
'menu_group_id',
|
||||
'menu_id'
|
||||
)->withPivot([
|
||||
'can_view',
|
||||
'can_create',
|
||||
'can_update',
|
||||
'can_delete',
|
||||
'can_approve',
|
||||
'can_export',
|
||||
])->withTimestamps();
|
||||
}
|
||||
|
||||
public function userMenuGroups()
|
||||
{
|
||||
return $this->hasMany(UserMenuGroup::class, 'menu_group_id');
|
||||
}
|
||||
|
||||
public function tenant()
|
||||
{
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user