| 1 | <?php |
||
| 13 | class Role extends Model |
||
| 14 | { |
||
| 15 | use HasPermission, RefreshCache; |
||
| 16 | |||
| 17 | /** @var string */ |
||
| 18 | protected $table = 'roles'; |
||
| 19 | |||
| 20 | /** @var array */ |
||
| 21 | protected $fillable = ['name', 'slug', 'description', 'system']; |
||
| 22 | |||
| 23 | /** @var array */ |
||
| 24 | protected $casts = [ |
||
| 25 | 'system' => 'bool', |
||
| 26 | ]; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Find a role by slug. |
||
| 30 | * |
||
| 31 | * @param string $slug |
||
| 32 | * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model |
||
| 33 | */ |
||
| 34 | public static function findBySlug(string $slug) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Roles can belong to many users. |
||
| 41 | * |
||
| 42 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
| 43 | */ |
||
| 44 | public function users(): BelongsToMany |
||
| 49 | } |
||
| 50 |