sls/app/Models/Role.php
2026-06-24 14:21:01 +05:30

30 lines
620 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Attributes\Fillable;
#[Fillable(['name', 'description'])]
class Role extends Model
{
use HasFactory;
/**
* Get the users assigned to this role.
*/
public function users()
{
return $this->belongsToMany(User::class, 'role_user');
}
/**
* Get the apps/services assigned to this role.
*/
public function apps()
{
return $this->belongsToMany(App::class, 'app_role', 'role_id', 'app_id');
}
}