mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
3.2.4
This commit is contained in:
25
app/Job.php
25
app/Job.php
@@ -6,7 +6,26 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Job extends Model
|
||||
{
|
||||
protected $casts = [
|
||||
'perm' => 'array',
|
||||
];
|
||||
public function permissions()
|
||||
{
|
||||
return collect(json_decode($this->permissions,true));
|
||||
}
|
||||
|
||||
public function permission($permission)
|
||||
{
|
||||
foreach ($this->permissions() as $perm => $value)
|
||||
{
|
||||
if ($permission == $perm)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function p($perm)
|
||||
{
|
||||
return $this->permission($perm);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user