create user role and menu, create seeder for first user and create crud role, menu and user

This commit is contained in:
arifal
2025-02-11 02:35:53 +07:00
parent 6307417ae3
commit cb90f69d1e
37 changed files with 1326 additions and 151 deletions

25
app/Models/Menu.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{
protected $table = 'menus';
protected $fillable = [
'name',
'url',
'icon',
'parent_id',
'sort_order'
];
public function roles(){
return $this->belongsToMany(Role::class, 'role_menu')->withTimestamps();
}
public function children(){
return $this->hasMany(Menu::class,'parent_id');
}
}