mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* App\Job
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $desc
|
|
* @property string $permissions
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereDesc($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job wherePermissions($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereUpdatedAt($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Job extends Model
|
|
{
|
|
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);
|
|
}
|
|
}
|