3 namespace BookStack\Auth\Permissions;
5 use BookStack\Auth\Role;
7 use Illuminate\Database\Eloquent\Relations\BelongsTo;
8 use Illuminate\Database\Eloquent\Relations\MorphTo;
12 * @property int $role_id
13 * @property int $entity_id
14 * @property string $entity_type
15 * @property boolean $view
16 * @property boolean $create
17 * @property boolean $update
18 * @property boolean $delete
20 class EntityPermission extends Model
22 public const PERMISSIONS = ['view', 'create', 'update', 'delete'];
24 protected $fillable = ['role_id', 'view', 'create', 'update', 'delete'];
25 public $timestamps = false;
28 * Get this restriction's attached entity.
30 public function restrictable(): MorphTo
32 return $this->morphTo('restrictable');
36 * Get the role assigned to this entity permission.
38 public function role(): BelongsTo
40 return $this->belongsTo(Role::class);