You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
738 B

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Menu extends Model
{
protected $fillable = [
'parent_id',
'path',
'name',
'title',
'component',
'icon',
'sort',
'visible',
'keep_alive',
'permission_code',
'status',
];
protected $casts = [
'parent_id' => 'integer',
'sort' => 'integer',
'visible' => 'integer',
'keep_alive' => 'integer',
'status' => 'integer',
];
public function roles(): BelongsToMany
{
return $this->belongsToMany(Role::class, 'role_menus', 'menu_id', 'role_id');
}
}