Conditions | 4 |
Paths | 5 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public static function roleMake($role) |
||
18 | { |
||
19 | $roleCriteria = explode(':',$role); |
||
20 | |||
21 | if(isset($roleCriteria[1])){ |
||
22 | $role = static::where('name',$roleCriteria[0])-> |
||
23 | where('status',1)->where('is_deleted',0)->where('role_state',$roleCriteria[1])->first(); |
||
24 | |||
25 | if(is_null($role)){ |
||
26 | exception('roleDefinitorException')->runtime('roleDefinitorException'); |
||
27 | } |
||
28 | |||
29 | if(auth()->user()->role_id == $role->id){ |
||
30 | return true; |
||
31 | } |
||
32 | |||
33 | return false; |
||
34 | } |
||
39 |