@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use App\Containers\Application\Models\Application; |
| 5 | 5 | use App\Containers\User\Models\User; |
| 6 | 6 | |
| 7 | -$factory->define(Application::class, function (Faker\Generator $faker) { |
|
| 7 | +$factory->define(Application::class, function(Faker\Generator $faker) { |
|
| 8 | 8 | |
| 9 | 9 | return [ |
| 10 | 10 | 'name' => $faker->name, |
@@ -33,12 +33,12 @@ |
||
| 33 | 33 | /** |
| 34 | 34 | * @param $userId |
| 35 | 35 | * @param null $token |
| 36 | - * @param null $expiresIn |
|
| 37 | - * @param null $refreshToken |
|
| 38 | - * @param null $tokenSecret |
|
| 36 | + * @param boolean|null $expiresIn |
|
| 37 | + * @param boolean|null $refreshToken |
|
| 38 | + * @param boolean|null $tokenSecret |
|
| 39 | 39 | * @param null $provider |
| 40 | 40 | * @param null $avatar |
| 41 | - * @param null $avatar_original |
|
| 41 | + * @param boolean|null $avatar_original |
|
| 42 | 42 | * @param null $socialId |
| 43 | 43 | * @param null $nickname |
| 44 | 44 | * @param null $name |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | $config = config('laravel-permission.table_names'); |
| 16 | 16 | |
| 17 | - Schema::create($config['roles'], function (Blueprint $table) { |
|
| 17 | + Schema::create($config['roles'], function(Blueprint $table) { |
|
| 18 | 18 | $table->increments('id'); |
| 19 | 19 | $table->string('name')->unique(); |
| 20 | 20 | $table->string('display_name')->nullable(); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $table->timestamps(); |
| 23 | 23 | }); |
| 24 | 24 | |
| 25 | - Schema::create($config['permissions'], function (Blueprint $table) { |
|
| 25 | + Schema::create($config['permissions'], function(Blueprint $table) { |
|
| 26 | 26 | $table->increments('id'); |
| 27 | 27 | $table->string('name')->unique(); |
| 28 | 28 | $table->string('display_name')->nullable(); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $table->timestamps(); |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | - Schema::create($config['user_has_permissions'], function (Blueprint $table) use ($config) { |
|
| 33 | + Schema::create($config['user_has_permissions'], function(Blueprint $table) use ($config) { |
|
| 34 | 34 | $table->integer('user_id')->unsigned(); |
| 35 | 35 | $table->integer('permission_id')->unsigned(); |
| 36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $table->primary(['user_id', 'permission_id']); |
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | - Schema::create($config['user_has_roles'], function (Blueprint $table) use ($config) { |
|
| 50 | + Schema::create($config['user_has_roles'], function(Blueprint $table) use ($config) { |
|
| 51 | 51 | $table->integer('role_id')->unsigned(); |
| 52 | 52 | $table->integer('user_id')->unsigned(); |
| 53 | 53 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $table->primary(['role_id', 'user_id']); |
| 65 | 65 | }); |
| 66 | 66 | |
| 67 | - Schema::create($config['role_has_permissions'], function (Blueprint $table) use ($config) { |
|
| 67 | + Schema::create($config['role_has_permissions'], function(Blueprint $table) use ($config) { |
|
| 68 | 68 | $table->integer('permission_id')->unsigned(); |
| 69 | 69 | $table->integer('role_id')->unsigned(); |
| 70 | 70 | |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | // be default give all users the client role (normal user) |
| 68 | 68 | $this->assignRoleTask->run($user, ['client']); |
| 69 | 69 | |
| 70 | - // add Client as role for normal users |
|
| 70 | + // add Client as role for normal users |
|
| 71 | 71 | $this->fireUserCreatedEventTask->run($user); |
| 72 | 72 | |
| 73 | 73 | return $user; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * GetAdminRoleAction constructor. |
| 23 | 23 | * |
| 24 | - * @param \App\Containers\Authorization\Data\Repositories\AssignRoleTask $assignRoleTask |
|
| 24 | + * @param AssignRoleTask $assignRoleTask |
|
| 25 | 25 | */ |
| 26 | 26 | public function __construct(AssignRoleTask $assignRoleTask) |
| 27 | 27 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function run($user, $roles) |
| 47 | 47 | { |
| 48 | - if(!$user instanceof User){ |
|
| 48 | + if (!$user instanceof User) { |
|
| 49 | 49 | $user = $this->findUserByIdTask->run($user); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $this->assignRole($user, $role); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - }else{ |
|
| 57 | + } else { |
|
| 58 | 58 | $this->assignRole($user, $roles); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | $this->assignRole($user, $role); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - }else{ |
|
| 57 | + } else{ |
|
| 58 | 58 | $this->assignRole($user, $roles); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -42,13 +42,13 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $role = $this->getRoleAction->run($roleName); |
| 44 | 44 | |
| 45 | - if(is_array($permissionNames)){ |
|
| 45 | + if (is_array($permissionNames)) { |
|
| 46 | 46 | |
| 47 | - foreach ($permissionNames as $permissionName){ |
|
| 47 | + foreach ($permissionNames as $permissionName) { |
|
| 48 | 48 | $role->givePermissionTo($permissionName); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - }else{ |
|
| 51 | + } else { |
|
| 52 | 52 | $role->givePermissionTo($permissionNames); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $role->givePermissionTo($permissionName); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - }else{ |
|
| 51 | + } else{ |
|
| 52 | 52 | $role->givePermissionTo($permissionNames); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $user = $this->webLoginTask->run($email, $password, $remember); |
| 49 | 49 | |
| 50 | - if($user){ |
|
| 50 | + if ($user) { |
|
| 51 | 51 | $this->isUserAdminTask->run($user); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $token = str_replace('Bearer ', '', $request->header('authorization')); |
| 95 | 95 | |
| 96 | - if(!$token){ |
|
| 96 | + if (!$token) { |
|
| 97 | 97 | throw new AuthenticationFailedException('Empty Token!'); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | throw new UserNotPermittedException(); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - }else{ |
|
| 116 | + } else { |
|
| 117 | 117 | return (App::make(\Dingo\Api\Http\Middleware\Auth::class))->handle($request, $next); |
| 118 | 118 | // another way to do handle this is by calling `$user = $this->jwtAuthAdapter->toUser($token);` |
| 119 | 119 | // and continuing the execution of this code till the last return, but to maintain consistency |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | throw new UserNotPermittedException(); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - }else{ |
|
| 121 | + } else{ |
|
| 122 | 122 | return (App::make(\Dingo\Api\Http\Middleware\Auth::class))->handle($request, $next); |
| 123 | 123 | // another way to do handle this is by calling `$user = $this->jwtAuthAdapter->toUser($token);` |
| 124 | 124 | // and continuing the execution of this code till the last return, but to maintain consistency |