Permission
extends Model
in package
uses
Sortable, HasFactory
Permission Model
This model manages system permissions and access control for the security system. It stores permission definitions, module relationships, and role associations for implementing role-based access control (RBAC) functionality.
Table of Contents
Properties
- $fillable : array<string|int, string>
- The attributes that are mass assignable.
Methods
- __construct() : void
- Create a new Permission model instance.
- module() : BelongsToMany
- Get the modules associated with this permission.
- roles() : BelongsToMany
- Get the roles that have this permission.
Properties
$fillable
The attributes that are mass assignable.
protected
array<string|int, string>
$fillable
= ['name', 'module_id', 'description', 'operation', 'created_by', 'updated_by', 'created_at', 'updated_at']
Methods
__construct()
Create a new Permission model instance.
public
__construct() : void
Sets the table name from configuration constants.
module()
Get the modules associated with this permission.
public
module() : BelongsToMany
This function used to check permission for module. Establishes a many-to-many relationship with the Module model.
Return values
BelongsToManyroles()
Get the roles that have this permission.
public
roles() : BelongsToMany
This function is used to check permission for role. Establishes a many-to-many relationship with the Role model.