1 | <?php |
||
9 | class Level extends Model implements AclLevelInterface |
||
10 | { |
||
11 | use UserAndLevel; |
||
12 | |||
13 | /** |
||
14 | * The attributes that should be cast to native types. |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $casts = ['id' => 'integer', 'rank' => 'integer']; |
||
19 | |||
20 | /** |
||
21 | * The attributes that aren't mass assignable. |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $guarded = ['id', 'created_id', 'updated_at']; |
||
26 | |||
27 | /** |
||
28 | * LEVEL |
||
29 | * A Level has many users |
||
30 | * |
||
31 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
32 | */ |
||
33 | 2 | public function users() |
|
37 | |||
38 | /** |
||
39 | * LEVEL |
||
40 | * A level has many permissions |
||
41 | * |
||
42 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
43 | */ |
||
44 | 15 | public function permissions() |
|
50 | |||
51 | |||
52 | /* ------------------------------------------------------------------------------------------------ |
||
53 | | Other Functions |
||
54 | | ------------------------------------------------------------------------------------------------ |
||
55 | */ |
||
56 | /** |
||
57 | * Level constructor. |
||
58 | * Sets the table name from the config |
||
59 | * |
||
60 | * @param array $attributes |
||
61 | */ |
||
62 | 55 | public function __construct(array $attributes = []) |
|
68 | |||
69 | /** |
||
70 | * Handle model events |
||
71 | */ |
||
72 | 55 | public static function boot() |
|
83 | } |
||
84 |