Page MenuHomePhorge

Permission.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

Permission.php

<?php
namespace App;
use App\Traits\UuidStrKeyTrait;
use Illuminate\Database\Eloquent\Model;
/**
* The eloquent definition of a Permission.
*
* @property string $id Permission identifier
* @property int $rights Access rights
* @property int $permissible_id The shared object identifier
* @property string $permissible_type The shared object type (class name)
* @property string $user Permitted user (email)
*/
class Permission extends Model
{
use UuidStrKeyTrait;
public const READ = 1;
public const WRITE = 2;
public const ADMIN = 4;
/** @var list<string> The attributes that are mass assignable */
protected $fillable = [
'permissible_id',
'permissible_type',
'rights',
'user',
];
/** @var array<string, string> The attributes that should be cast */
protected $casts = [
'rights' => 'integer',
];
/**
* Principally permissible object such as Room.
* Note that it may be trashed (soft-deleted).
*
* @return mixed
*/
public function permissible()
{
return $this->morphTo()->withTrashed();
}
/**
* Rights mutator. Make sure rights is integer.
*/
public function setRightsAttribute($rights): void
{
$this->attributes['rights'] = (int) $rights;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Apr 4, 8:00 AM (1 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
95/82/da9e028909b18e74cbf55a388862
Default Alt Text
Permission.php (1 KB)

Event Timeline