improvements

This commit is contained in:
Mark Gregory
2026-08-26 09:04:25 +01:00
parent 5844aeb621
commit 53a11ae0c7
13 changed files with 479 additions and 36 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Modules\UserManagement\Models;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
final class Role extends Model
{
protected $table = 'user_management_roles';
protected $fillable = ['name', 'slug', 'description', 'is_system'];
protected $casts = ['is_system' => 'boolean'];
public function permissions(): BelongsToMany
{
return $this->belongsToMany(
Permission::class,
'user_management_permission_role',
'role_id',
'permission_id'
);
}
public function users(): BelongsToMany
{
return $this->belongsToMany(
User::class,
'user_management_role_user',
'role_id',
'user_id'
);
}
}