@@ -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(); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('password_resets', function (Blueprint $table) { |
|
| 15 | + Schema::create('password_resets', function(Blueprint $table) { |
|
| 16 | 16 | $table->string('email')->index(); |
| 17 | 17 | $table->string('token')->index(); |
| 18 | 18 | $table->timestamp('created_at'); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $permissions = []; |
| 29 | 29 | $user = $this->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 (! $this->model->where('email', $user->email)->first()) { |
|
| 134 | + if ( ! $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 = $this->model->with($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 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function toArray($request) |
| 19 | 19 | { |
| 20 | - if (! $this->resource) { |
|
| 20 | + if ( ! $this->resource) { |
|
| 21 | 21 | return []; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -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 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -Route::group(['prefix' => 'push/notification/devices'], function () { |
|
| 16 | +Route::group(['prefix' => 'push/notification/devices'], function() { |
|
| 17 | 17 | |
| 18 | 18 | Route::get('/', 'PushNotificationDeviceController@index'); |
| 19 | 19 | Route::get('/{id}', 'PushNotificationDeviceController@find'); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Route::group([ |
| 55 | 55 | 'middleware' => 'web', |
| 56 | 56 | 'namespace' => $this->namespace, |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require module_path('push-notification-devices', 'Routes/web.php', 'app'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | 'middleware' => 'api', |
| 73 | 73 | 'namespace' => $this->namespace, |
| 74 | 74 | 'prefix' => 'api', |
| 75 | - ], function ($router) { |
|
| 75 | + ], function($router) { |
|
| 76 | 76 | require module_path('push-notification-devices', 'Routes/api.php', 'app'); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\PushNotificationDevices\PushNotificationDevice::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\PushNotificationDevices\PushNotificationDevice::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'device_token' => $faker->sha1(), |
| 6 | 6 | 'user_id' => $faker->randomDigitNotNull(), |
@@ -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', ['pushNotificationDevice'])->each(function ($permission) use ($adminGroupId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function($permission) use ($adminGroupId) { |
|
| 22 | 22 | \DB::table('groups_permissions')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |