@@ -35,7 +35,7 @@ |
||
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); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->getPostData($route, $reflectionMethod, $validationRules); |
63 | 63 | |
64 | 64 | preg_match('/api\/v1\/([^#]+)\//iU', $route['uri'], $module); |
65 | - preg_match('/api\/v1\/' . $module[1] . '\/([^#]+)\//iU', $route['uri'], $model); |
|
65 | + preg_match('/api\/v1\/'.$module[1].'\/([^#]+)\//iU', $route['uri'], $model); |
|
66 | 66 | $docData['modules'][$module[1]][$model[1]][] = $route; |
67 | 67 | |
68 | 68 | $this->getModels($classProperties['model'], $docData); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function getRoutes() |
82 | 82 | { |
83 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
83 | + return collect(\Route::getRoutes())->map(function($route) { |
|
84 | 84 | if (strpos($route->uri(), 'api/v') !== false) |
85 | 85 | { |
86 | 86 | return [ |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ]; |
113 | 113 | |
114 | 114 | |
115 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
115 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
116 | 116 | { |
117 | 117 | $route['headers']['Authrization'] = 'bearer {token}'; |
118 | 118 | } |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | } |
166 | 166 | else |
167 | 167 | { |
168 | - $route['body'] = eval('return ' . $match[1] . ';'); |
|
168 | + $route['body'] = eval('return '.$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 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $user = \Core::users()->find(\JWTAuth::parseToken()->authenticate()->id, $relations); |
27 | 27 | foreach ($user->groups()->get() as $group) |
28 | 28 | { |
29 | - $group->permissions->each(function ($permission) use (&$permissions){ |
|
29 | + $group->permissions->each(function($permission) use (&$permissions){ |
|
30 | 30 | $permissions[$permission->model][$permission->id] = $permission->name; |
31 | 31 | }); |
32 | 32 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param boolean $user |
45 | 45 | * @return boolean |
46 | 46 | */ |
47 | - public function can($nameOfPermission, $model, $user = false ) |
|
47 | + public function can($nameOfPermission, $model, $user = false) |
|
48 | 48 | { |
49 | 49 | $user = $user ?: \JWTAuth::parseToken()->authenticate(); |
50 | 50 | $permissions = []; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | \ErrorHandler::tokenExpired(); |
55 | 55 | } |
56 | 56 | |
57 | - $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){ |
|
57 | + $user->groups->pluck('permissions')->each(function($permission) use (&$permissions, $model){ |
|
58 | 58 | $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); |
59 | 59 | }); |
60 | 60 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param integer $userId |
69 | 69 | * @return boolean |
70 | 70 | */ |
71 | - public function hasGroup($groupName, $userId = fa;se) |
|
71 | + public function hasGroup($groupName, $userId = fa; se) |
|
72 | 72 | { |
73 | 73 | $userId = $userId ?: \JWTAuth::parseToken()->authenticate()->id; |
74 | 74 | $groups = $this->find($userId)->groups; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function assignGroups($user_id, $group_ids) |
86 | 86 | { |
87 | - \DB::transaction(function () use ($user_id, $group_ids) { |
|
87 | + \DB::transaction(function() use ($user_id, $group_ids) { |
|
88 | 88 | $user = $this->find($user_id); |
89 | 89 | $user->groups()->detach(); |
90 | 90 | $user->groups()->attach($group_ids); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $url = $this->config['resetLink']; |
248 | 248 | $token = \Password::getRepository()->create($user); |
249 | 249 | |
250 | - \Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function ($m) use ($user) { |
|
250 | + \Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function($m) use ($user) { |
|
251 | 251 | $m->to($user->email, $user->name)->subject('Your Password Reset Link'); |
252 | 252 | }); |
253 | 253 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function resetPassword($credentials) |
262 | 262 | { |
263 | 263 | $token = false; |
264 | - $response = \Password::reset($credentials, function ($user, $password) use (&$token) { |
|
264 | + $response = \Password::reset($credentials, function($user, $password) use (&$token) { |
|
265 | 265 | $user->password = $password; |
266 | 266 | $user->save(); |
267 | 267 |