@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | use SoftDeletes, HasApiTokens; |
| 11 | 11 | protected $table = 'users'; |
| 12 | 12 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
| 13 | - protected $hidden = ['password', 'remember_token','deleted_at', 'two_factor_code']; |
|
| 13 | + protected $hidden = ['password', 'remember_token', 'deleted_at', 'two_factor_code']; |
|
| 14 | 14 | protected $guarded = ['id']; |
| 15 | 15 | protected $fillable = ['name', 'email', 'password']; |
| 16 | 16 | public $searchable = ['name', 'email']; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function groups() |
| 45 | 45 | { |
| 46 | - return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 46 | + return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function receivesBroadcastNotificationsOn() |
| 86 | 86 | { |
| 87 | - return 'users.' . $this->id; |
|
| 87 | + return 'users.'.$this->id; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public static function boot() |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Assign the permissions to the admin group. |
| 20 | 20 | */ |
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function($permission) use ($adminGroupId) { |
|
| 22 | 22 | \DB::table('groups_permissions')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $route['response'] = $this->getResponseObject($classProperties['model'], $route['name'], $route['returnDocBlock']); |
| 63 | 63 | |
| 64 | 64 | preg_match('/api\/v1\/([^#]+)\//iU', $route['uri'], $module); |
| 65 | - $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/v1/' . $module[1] . '/') - 1)][] = $route; |
|
| 65 | + $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/v1/'.$module[1].'/') - 1)][] = $route; |
|
| 66 | 66 | |
| 67 | 67 | $this->getModels($classProperties['model'], $docData); |
| 68 | 68 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | protected function getRoutes() |
| 81 | 81 | { |
| 82 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
| 82 | + return collect(\Route::getRoutes())->map(function($route) { |
|
| 83 | 83 | if (strpos($route->uri(), 'api/v') !== false) |
| 84 | 84 | { |
| 85 | 85 | return [ |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
| 114 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
| 115 | 115 | { |
| 116 | 116 | $route['headers']['Authrization'] = 'Bearer {token}'; |
| 117 | 117 | } |
@@ -165,16 +165,16 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | else |
| 167 | 167 | { |
| 168 | - $route['body'] = eval('return ' . str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]) . ';'); |
|
| 168 | + $route['body'] = eval('return '.str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]).';'); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | foreach ($route['body'] as &$rule) |
| 172 | 172 | { |
| 173 | - if(strpos($rule, 'unique')) |
|
| 173 | + if (strpos($rule, 'unique')) |
|
| 174 | 174 | { |
| 175 | 175 | $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
| 176 | 176 | } |
| 177 | - elseif(strpos($rule, 'exists')) |
|
| 177 | + elseif (strpos($rule, 'exists')) |
|
| 178 | 178 | { |
| 179 | 179 | $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
| 180 | 180 | } |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | $model = factory($modelClass)->make(); |
| 248 | 248 | $modelArr = $model->toArray(); |
| 249 | 249 | |
| 250 | - if ( $model->trans && ! $model->trans->count()) |
|
| 250 | + if ($model->trans && ! $model->trans->count()) |
|
| 251 | 251 | { |
| 252 | 252 | $modelArr['trans'] = [ |
| 253 | - 'en' => factory($modelClass . 'Translation')->make()->toArray() |
|
| 253 | + 'en' => factory($modelClass.'Translation')->make()->toArray() |
|
| 254 | 254 | ]; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -162,8 +162,7 @@ discard block |
||
| 162 | 162 | if ($match[1] == '$this->validationRules') |
| 163 | 163 | { |
| 164 | 164 | $route['body'] = $validationRules; |
| 165 | - } |
|
| 166 | - else |
|
| 165 | + } else |
|
| 167 | 166 | { |
| 168 | 167 | $route['body'] = eval('return ' . str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]) . ';'); |
| 169 | 168 | } |
@@ -173,14 +172,12 @@ discard block |
||
| 173 | 172 | if(strpos($rule, 'unique')) |
| 174 | 173 | { |
| 175 | 174 | $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
| 176 | - } |
|
| 177 | - elseif(strpos($rule, 'exists')) |
|
| 175 | + } elseif(strpos($rule, 'exists')) |
|
| 178 | 176 | { |
| 179 | 177 | $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
| 180 | 178 | } |
| 181 | 179 | } |
| 182 | - } |
|
| 183 | - else |
|
| 180 | + } else |
|
| 184 | 181 | { |
| 185 | 182 | $route['body'] = 'conditions'; |
| 186 | 183 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : []; |
| 36 | 36 | $this->skipLoginCheck = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : []; |
| 37 | 37 | $this->repo = call_user_func_array("\Core::{$this->model}", []); |
| 38 | - $route = explode('@',\Route::currentRouteAction())[1]; |
|
| 38 | + $route = explode('@', \Route::currentRouteAction())[1]; |
|
| 39 | 39 | |
| 40 | 40 | $this->checkPermission($route); |
| 41 | 41 | $this->setRelations($route); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model))) |
| 255 | 255 | {} |
| 256 | - elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) |
|
| 256 | + elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) |
|
| 257 | 257 | {} |
| 258 | 258 | else |
| 259 | 259 | { |
@@ -173,8 +173,7 @@ discard block |
||
| 173 | 173 | if ($request->has('id')) |
| 174 | 174 | { |
| 175 | 175 | $rule = str_replace('{id}', $request->get('id'), $rule); |
| 176 | - } |
|
| 177 | - else |
|
| 176 | + } else |
|
| 178 | 177 | { |
| 179 | 178 | $rule = str_replace(',{id}', '', $rule); |
| 180 | 179 | } |
@@ -252,10 +251,8 @@ discard block |
||
| 252 | 251 | } |
| 253 | 252 | |
| 254 | 253 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model))) |
| 255 | - {} |
|
| 256 | - elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) |
|
| 257 | - {} |
|
| 258 | - else |
|
| 254 | + {} elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) |
|
| 255 | + {} else |
|
| 259 | 256 | { |
| 260 | 257 | |
| 261 | 258 | \ErrorHandler::noPermissions(); |