sls/app/Models/Role.php
2026-07-20 20:22:03 +05:30

38 lines
716 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $fillable = [
'name',
'description',
'can_manage_onboarding',
];
protected $casts = [
'can_manage_onboarding' => 'boolean',
];
/**
* 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');
}
}