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 | * The table associated with the model. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $table; |
||
33 | |||
34 | /** |
||
35 | * LEVEL |
||
36 | * A Level has many users |
||
37 | * |
||
38 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
39 | */ |
||
40 | 2 | public function users() |
|
41 | { |
||
42 | 2 | return $this->hasMany(config('laravel-acl.user')); |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * LEVEL |
||
47 | * A level has many permissions |
||
48 | * |
||
49 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
50 | */ |
||
51 | 14 | public function permissions() |
|
57 | |||
58 | |||
59 | /* ------------------------------------------------------------------------------------------------ |
||
60 | | Other Functions |
||
61 | | ------------------------------------------------------------------------------------------------ |
||
62 | */ |
||
63 | /** |
||
64 | * Level constructor. |
||
65 | * Sets the table name from the config |
||
66 | * |
||
67 | * @param array $attributes |
||
68 | */ |
||
69 | 53 | public function __construct(array $attributes = []) |
|
75 | |||
76 | /** |
||
77 | * Handle model events |
||
78 | */ |
||
79 | 53 | public static function boot() |
|
90 | } |
||
91 |