@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $user = \Core::users()->find(\Auth::id(), $relations); |
50 | 50 | foreach ($user->groups()->get() as $group) |
51 | 51 | { |
52 | - $group->permissions->each(function ($permission) use (&$permissions){ |
|
52 | + $group->permissions->each(function($permission) use (&$permissions){ |
|
53 | 53 | $permissions[$permission->model][$permission->id] = $permission->name; |
54 | 54 | }); |
55 | 55 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $user = $user ?: $this->find(\Auth::id(), ['groups.permissions']); |
73 | 73 | $permissions = []; |
74 | 74 | |
75 | - $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){ |
|
75 | + $user->groups->pluck('permissions')->each(function($permission) use (&$permissions, $model){ |
|
76 | 76 | $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); |
77 | 77 | }); |
78 | 78 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function assignGroups($user_id, $group_ids) |
104 | 104 | { |
105 | - \DB::transaction(function () use ($user_id, $group_ids) { |
|
105 | + \DB::transaction(function() use ($user_id, $group_ids) { |
|
106 | 106 | $user = $this->find($user_id); |
107 | 107 | $user->groups()->detach(); |
108 | 108 | $user->groups()->attach($group_ids); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $url = $this->config['resetLink']; |
252 | 252 | $token = \Password::getRepository()->create($user); |
253 | 253 | |
254 | - \Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function ($m) use ($user) { |
|
254 | + \Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function($m) use ($user) { |
|
255 | 255 | $m->to($user->email, $user->name)->subject('Your Password Reset Link'); |
256 | 256 | }); |
257 | 257 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function resetPassword($credentials) |
266 | 266 | { |
267 | - $response = \Password::reset($credentials, function ($user, $password) { |
|
267 | + $response = \Password::reset($credentials, function($user, $password) { |
|
268 | 268 | $user->password = $password; |
269 | 269 | $user->save(); |
270 | 270 | }); |
@@ -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 |
@@ -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 | { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * to preform actions like (add, edit ... etc). |
14 | 14 | * @var string |
15 | 15 | */ |
16 | - protected $model = 'users'; |
|
16 | + protected $model = 'users'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * List of all route actions that the base api controller |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * will skip login check for them. |
28 | 28 | * @var array |
29 | 29 | */ |
30 | - protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken']; |
|
30 | + protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken']; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * The validations rules used by the base api controller |
34 | 34 | * to check before add. |
35 | 35 | * @var array |
36 | 36 | */ |
37 | - protected $validationRules = [ |
|
37 | + protected $validationRules = [ |
|
38 | 38 | 'name' => 'nullable|string', |
39 | 39 | 'email' => 'required|email|unique:users,email,{id}', |
40 | 40 | 'password' => 'nullable|min:6' |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | $this->validate($request, [ |
251 | 251 | 'name' => 'nullable|string', |
252 | - 'email' => 'required|email|unique:users,email,' . \Auth::id() |
|
252 | + 'email' => 'required|email|unique:users,email,'.\Auth::id() |
|
253 | 253 | ]); |
254 | 254 | |
255 | 255 | return \Response::json($this->repo->saveProfile($request->only('name', 'email')), 200); |
@@ -13,14 +13,14 @@ |
||
13 | 13 | * to preform actions like (add, edit ... etc). |
14 | 14 | * @var string |
15 | 15 | */ |
16 | - protected $model = 'oauthClients'; |
|
16 | + protected $model = 'oauthClients'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * The validations rules used by the base api controller |
20 | 20 | * to check before add. |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - protected $validationRules = [ |
|
23 | + protected $validationRules = [ |
|
24 | 24 | 'name' => 'required|max:255', |
25 | 25 | 'redirect' => 'required|url', |
26 | 26 | 'user_id' => 'required|exists:users,id', |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | ], |
21 | 21 | [ |
22 | 22 | 'title' => 'email equal [email protected] and user is blocked:', |
23 | - 'content' => ['and' => ['email' => '[email protected]','blocked' => 1]] |
|
23 | + 'content' => ['and' => ['email' => '[email protected]', 'blocked' => 1]] |
|
24 | 24 | ], |
25 | 25 | [ |
26 | 26 | 'title' => 'email equal [email protected] or user is blocked:', |
27 | - 'content' => ['or' => ['email' => '[email protected]','blocked' => 1]] |
|
27 | + 'content' => ['or' => ['email' => '[email protected]', 'blocked' => 1]] |
|
28 | 28 | ], |
29 | 29 | [ |
30 | 30 | 'title' => 'email contain John:', |
31 | - 'content' => ['email' => ['op' => 'like','val' => '%John%']] |
|
31 | + 'content' => ['email' => ['op' => 'like', 'val' => '%John%']] |
|
32 | 32 | ], |
33 | 33 | [ |
34 | 34 | 'title' => 'user created after 2016-10-25:', |
35 | - 'content' => ['created_at' => ['op' => '>','val' => '2016-10-25']] |
|
35 | + 'content' => ['created_at' => ['op' => '>', 'val' => '2016-10-25']] |
|
36 | 36 | ], |
37 | 37 | [ |
38 | 38 | 'title' => 'user created between 2016-10-20 and 2016-10-25:', |
39 | - 'content' => ['created_at' => ['op' => 'between','val1' => '2016-10-20','val2' => '2016-10-25']] |
|
39 | + 'content' => ['created_at' => ['op' => 'between', 'val1' => '2016-10-20', 'val2' => '2016-10-25']] |
|
40 | 40 | ], |
41 | 41 | [ |
42 | 42 | 'title' => 'user id in 1,2,3:', |
43 | - 'content' => ['id' => ['op' => 'in','val' => [1, 2, 3]]] |
|
43 | + 'content' => ['id' => ['op' => 'in', 'val' => [1, 2, 3]]] |
|
44 | 44 | ], |
45 | 45 | [ |
46 | 46 | 'title' => 'user name is null:', |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ], |
53 | 53 | [ |
54 | 54 | 'title' => 'user has group admin:', |
55 | - 'content' => ['groups' => ['op' => 'has','val' => ['name' => 'Admin']]] |
|
55 | + 'content' => ['groups' => ['op' => 'has', 'val' => ['name' => 'Admin']]] |
|
56 | 56 | ] |
57 | 57 | ]; |
58 | 58 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | \ErrorHandler::notFound('report'); |
42 | 42 | } |
43 | - else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
43 | + else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
44 | 44 | { |
45 | 45 | \ErrorHandler::noPermissions(); |
46 | 46 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Illuminate\Notifications\DatabaseNotification; |
4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
5 | 5 | |
6 | -class Notification extends DatabaseNotification{ |
|
6 | +class Notification extends DatabaseNotification { |
|
7 | 7 | |
8 | 8 | public function getCreatedAtAttribute($value) |
9 | 9 | { |