3 namespace BookStack\Auth\Permissions;
5 use BookStack\Auth\Role;
7 use Illuminate\Database\Eloquent\Relations\BelongsTo;
11 * @property int $role_id
12 * @property int $entity_id
13 * @property string $entity_type
14 * @property boolean $view
15 * @property boolean $create
16 * @property boolean $update
17 * @property boolean $delete
19 class EntityPermission extends Model
21 public const PERMISSIONS = ['view', 'create', 'update', 'delete'];
23 protected $fillable = ['role_id', 'view', 'create', 'update', 'delete'];
24 public $timestamps = false;
25 protected $hidden = ['entity_id', 'entity_type', 'id'];
28 'create' => 'boolean',
30 'update' => 'boolean',
31 'delete' => 'boolean',
35 * Get the role assigned to this entity permission.
37 public function role(): BelongsTo
39 return $this->belongsTo(Role::class);