Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2528742
Permission.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Permission.php
View Options
<?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 array<int, 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
();
// @phpstan-ignore-line
}
/**
* Rights mutator. Make sure rights is integer.
*/
public
function
setRightsAttribute
(
$rights
):
void
{
$this
->
attributes
[
'rights'
]
=
(
int
)
$rights
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Feb 1, 7:24 PM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
426771
Default Alt Text
Permission.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment