@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function permissionMake($routeName) |
| 18 | 18 | {
|
| 19 | - $permission = static::where('route_name',$routeName)->where('role_id',auth()->user()->role_id);
|
|
| 19 | + $permission = static::where('route_name', $routeName)->where('role_id', auth()->user()->role_id);
|
|
| 20 | 20 | |
| 21 | 21 | return ($permission->count()) ? true : false; |
| 22 | 22 | } |
@@ -16,17 +16,17 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function roleMake($role) |
| 18 | 18 | {
|
| 19 | - $roleCriteria = explode(':',$role);
|
|
| 19 | + $roleCriteria = explode(':', $role);
|
|
| 20 | 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();
|
|
| 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 | 24 | |
| 25 | - if(is_null($role)){
|
|
| 25 | + if (is_null($role)) {
|
|
| 26 | 26 | exception('roleDefinitorException')->runtime('roleDefinitorException');
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if(auth()->user()->role_id == $role->id){
|
|
| 29 | + if (auth()->user()->role_id==$role->id) {
|
|
| 30 | 30 | return true; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | $permission = $this->getPermission(); |
| 65 | 65 | $role = $this->getRole(); |
| 66 | 66 | |
| 67 | - if(is_null($this->role)){ |
|
| 67 | + if (is_null($this->role)) { |
|
| 68 | 68 | return $permission::permissionMake($this->routeName); |
| 69 | 69 | } |
| 70 | - else{ |
|
| 70 | + else { |
|
| 71 | 71 | return $role::roleMake($this->role); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param string $adapter |
| 105 | 105 | * @return RoleManager |
| 106 | 106 | */ |
| 107 | - public function setAdapter($adapter='Database') |
|
| 107 | + public function setAdapter($adapter = 'Database') |
|
| 108 | 108 | { |
| 109 | 109 | $this->adapter = $adapter; |
| 110 | 110 | |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | if(is_null($this->role)){ |
| 68 | 68 | return $permission::permissionMake($this->routeName); |
| 69 | - } |
|
| 70 | - else{ |
|
| 69 | + } else{ |
|
| 71 | 70 | return $role::roleMake($this->role); |
| 72 | 71 | } |
| 73 | 72 | } |