Skip to content

Authorization ​

File: src/Entities/Authorization.php
Namespace: Unusualify\Modularous\Entities
Extends: Illuminate\Database\Eloquent\Model

Polymorphic pivot model that links an authorized entity (e.g. a user) to an authorizable model. Dispatches notification events when records are created or the authorized party changes.

Fillable Attributes ​

AttributeTypeDescription
authorized_idintThe entity that has authorization
authorized_typestringAuthorized entity's class
authorizable_idintThe model being authorized on
authorizable_typestringAuthorizable model's class

Boot Events ​

EventAction
createdDispatches AuthorizableCreated
updatedDispatches AuthorizableUpdated (only when authorized_id or authorized_type changes)

Relationships ​

authorized(): MorphTo ​

The entity (typically a user) that holds authorization.

authorizable(): MorphTo ​

The model this authorization applies to.

Table ​

Resolved from modularous.tables.authorizations, defaults to modularous_authorizations.