@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('permissions', function (Blueprint $table) { |
|
15 | + Schema::create('permissions', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('name', 100); |
18 | 18 | $table->string('model', 100); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $table->timestamps(); |
21 | 21 | $table->unique(array('name', 'model')); |
22 | 22 | }); |
23 | - Schema::create('groups_permissions', function (Blueprint $table) { |
|
23 | + Schema::create('groups_permissions', function(Blueprint $table) { |
|
24 | 24 | $table->increments('id'); |
25 | 25 | $table->integer('group_id'); |
26 | 26 | $table->integer('permission_id'); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('users', function (Blueprint $table) { |
|
15 | + Schema::create('users', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('profile_picture', 150)->nullable(); |
18 | 18 | $table->string('name', 100)->nullable(); |
@@ -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, |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $response = \ApiConsumer::post('/oauth/token', $data); |
53 | 53 | |
54 | - if (! $response->isSuccessful()) { |
|
54 | + if ( ! $response->isSuccessful()) { |
|
55 | 55 | if ($grantType == 'refresh_token') { |
56 | 56 | \ErrorHandler::invalidRefreshToken(); |
57 | 57 | } |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'acl'], function () { |
|
14 | +Route::group(['prefix' => 'acl'], function() { |
|
15 | 15 | |
16 | - Route::group(['prefix' => 'users'], function () { |
|
16 | + Route::group(['prefix' => 'users'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('list/{sortBy?}/{desc?}', 'UsersController@index'); |
19 | 19 | Route::get('find/{id}', 'UsersController@find'); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | Route::post('group/{groupName}/{perPage?}/{sortBy?}/{desc?}', 'UsersController@group'); |
45 | 45 | }); |
46 | 46 | |
47 | - Route::group(['prefix' => 'groups'], function () { |
|
47 | + Route::group(['prefix' => 'groups'], function() { |
|
48 | 48 | |
49 | 49 | Route::get('list/{sortBy?}/{desc?}', 'GroupsController@index'); |
50 | 50 | Route::get('find/{id}', 'GroupsController@find'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | Route::post('assignpermissions', 'GroupsController@assignpermissions'); |
61 | 61 | }); |
62 | 62 | |
63 | - Route::group(['prefix' => 'permissions'], function () { |
|
63 | + Route::group(['prefix' => 'permissions'], function() { |
|
64 | 64 | |
65 | 65 | Route::get('list/{sortBy?}/{desc?}', 'PermissionsController@index'); |
66 | 66 | Route::get('find/{id}', 'PermissionsController@find'); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'PermissionsController@paginateby'); |
72 | 72 | }); |
73 | 73 | |
74 | - Route::group(['prefix' => 'oauth/clients'], function () { |
|
74 | + Route::group(['prefix' => 'oauth/clients'], function() { |
|
75 | 75 | |
76 | 76 | Route::get('list/{sortBy?}/{desc?}', 'OauthClientsController@index'); |
77 | 77 | Route::get('find/{id}', 'OauthClientsController@find'); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function updated($model) |
37 | 37 | { |
38 | 38 | if ($model->isDirty('blocked') && $model->blocked) { |
39 | - $model->tokens()->each(function ($token) { |
|
39 | + $model->tokens()->each(function($token) { |
|
40 | 40 | |
41 | 41 | \Core::users()->revokeAccessToken($token); |
42 | 42 | }); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function assignPermissions($groupId, $permissionIds) |
25 | 25 | { |
26 | - \DB::transaction(function () use ($groupId, $permissionIds) { |
|
26 | + \DB::transaction(function() use ($groupId, $permissionIds) { |
|
27 | 27 | $group = $this->find($groupId); |
28 | 28 | $group->permissions()->detach(); |
29 | 29 | $group->permissions()->attach($permissionIds); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $permissions = []; |
29 | 29 | $user = \Core::users()->find(\Auth::id(), $relations); |
30 | 30 | foreach ($user->groups()->get() as $group) { |
31 | - $group->permissions->each(function ($permission) use (&$permissions) { |
|
31 | + $group->permissions->each(function($permission) use (&$permissions) { |
|
32 | 32 | $permissions[$permission->model][$permission->id] = $permission->name; |
33 | 33 | }); |
34 | 34 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $user = $user ?: $this->find(\Auth::id(), ['groups.permissions']); |
52 | 52 | $permissions = []; |
53 | 53 | |
54 | - $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model) { |
|
54 | + $user->groups->pluck('permissions')->each(function($permission) use (&$permissions, $model) { |
|
55 | 55 | $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); |
56 | 56 | }); |
57 | 57 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function assignGroups($userId, $groupIds) |
82 | 82 | { |
83 | - \DB::transaction(function () use ($userId, $groupIds) { |
|
83 | + \DB::transaction(function() use ($userId, $groupIds) { |
|
84 | 84 | $user = $this->find($userId); |
85 | 85 | $user->groups()->detach(); |
86 | 86 | $user->groups()->attach($groupIds); |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function login($credentials, $adminLogin = false) |
101 | 101 | { |
102 | - if (! $user = $this->first(['email' => $credentials['email']])) { |
|
102 | + if ( ! $user = $this->first(['email' => $credentials['email']])) { |
|
103 | 103 | \ErrorHandler::loginFailed(); |
104 | 104 | } elseif ($adminLogin && ! $user->groups->whereIn('name', ['Admin'])->count()) { |
105 | 105 | \ErrorHandler::loginFailed(); |
106 | - } elseif (! $adminLogin && $user->groups->whereIn('name', ['Admin'])->count()) { |
|
106 | + } elseif ( ! $adminLogin && $user->groups->whereIn('name', ['Admin'])->count()) { |
|
107 | 107 | \ErrorHandler::loginFailed(); |
108 | 108 | } elseif ($user->blocked) { |
109 | 109 | \ErrorHandler::userIsBlocked(); |
110 | - } elseif (! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
110 | + } elseif ( ! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
111 | 111 | \ErrorHandler::emailNotConfirmed(); |
112 | 112 | } |
113 | 113 | |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | $access_token = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken; |
128 | 128 | $user = \Socialite::driver($type)->userFromToken($access_token); |
129 | 129 | |
130 | - if (! $user->email) { |
|
130 | + if ( ! $user->email) { |
|
131 | 131 | \ErrorHandler::noSocialEmail(); |
132 | 132 | } |
133 | 133 | |
134 | - if (! $registeredUser = $this->model->where('email', $user->email)->first()) { |
|
134 | + if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) { |
|
135 | 135 | $this->register(['email' => $user->email, 'password' => ''], true); |
136 | 136 | } |
137 | 137 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | if ($skipConfirmEmail) { |
154 | 154 | $user->confirmed = 1; |
155 | 155 | $user->save(); |
156 | - } elseif (! config('skeleton.disable_confirm_email')) { |
|
156 | + } elseif ( ! config('skeleton.disable_confirm_email')) { |
|
157 | 157 | $this->sendConfirmationEmail($user->email); |
158 | 158 | } |
159 | 159 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function block($userId) |
170 | 170 | { |
171 | - if (! $user = $this->find($userId)) { |
|
171 | + if ( ! $user = $this->find($userId)) { |
|
172 | 172 | \ErrorHandler::notFound('user'); |
173 | 173 | } |
174 | - if (! $this->hasGroup(['Admin'])) { |
|
174 | + if ( ! $this->hasGroup(['Admin'])) { |
|
175 | 175 | \ErrorHandler::noPermissions(); |
176 | 176 | } elseif (\Auth::id() == $userId) { |
177 | 177 | \ErrorHandler::noPermissions(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function unblock($userId) |
195 | 195 | { |
196 | - if (! $this->hasGroup(['Admin'])) { |
|
196 | + if ( ! $this->hasGroup(['Admin'])) { |
|
197 | 197 | \ErrorHandler::noPermissions(); |
198 | 198 | } |
199 | 199 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function sendReset($email) |
214 | 214 | { |
215 | - if (! $user = $this->model->where('email', $email)->first()) { |
|
215 | + if ( ! $user = $this->model->where('email', $email)->first()) { |
|
216 | 216 | \ErrorHandler::notFound('email'); |
217 | 217 | } |
218 | 218 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function resetPassword($credentials) |
230 | 230 | { |
231 | - $response = \Password::reset($credentials, function ($user, $password) { |
|
231 | + $response = \Password::reset($credentials, function($user, $password) { |
|
232 | 232 | $user->password = $password; |
233 | 233 | $user->save(); |
234 | 234 | }); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | public function changePassword($credentials) |
264 | 264 | { |
265 | 265 | $user = \Auth::user(); |
266 | - if (! \Hash::check($credentials['old_password'], $user->password)) { |
|
266 | + if ( ! \Hash::check($credentials['old_password'], $user->password)) { |
|
267 | 267 | \ErrorHandler::invalidOldPassword(); |
268 | 268 | } |
269 | 269 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function confirmEmail($confirmationCode) |
281 | 281 | { |
282 | - if (! $user = $this->first(['confirmation_code' => $confirmationCode])) { |
|
282 | + if ( ! $user = $this->first(['confirmation_code' => $confirmationCode])) { |
|
283 | 283 | \ErrorHandler::invalidConfirmationCode(); |
284 | 284 | } |
285 | 285 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $sort = $desc ? 'desc' : 'asc'; |
325 | 325 | $model = call_user_func_array("{$this->getModel()}::with", array($relations)); |
326 | 326 | |
327 | - $model->whereHas('groups', function ($q) use ($groupName) { |
|
327 | + $model->whereHas('groups', function($q) use ($groupName) { |
|
328 | 328 | $q->where('name', $groupName); |
329 | 329 | }); |
330 | 330 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Core\Settings::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Core\Settings::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
6 | 6 | 'value' => $faker->word(), |