@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $email = $firstname = $lastname = ''; |
| 33 | 33 | |
| 34 | - if($request->session()->has('user_to_register')){ |
|
| 34 | + if ($request->session()->has('user_to_register')) { |
|
| 35 | 35 | $user = $request->session()->get('user_to_register'); |
| 36 | 36 | $email = $user['email']; |
| 37 | 37 | $firstname = $user['firstname']; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | protected function validator(array $data) |
| 49 | 49 | { |
| 50 | - if(session()->has('should_attach_to_organization')) { |
|
| 50 | + if (session()->has('should_attach_to_organization')) { |
|
| 51 | 51 | session()->reflash(); |
| 52 | 52 | } |
| 53 | 53 | return Validator::make($data, [ |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | protected function registered(Request $request, $user) |
| 83 | 83 | { |
| 84 | - if($request->session()->has('should_attach_to_organization')){ |
|
| 84 | + if ($request->session()->has('should_attach_to_organization')) { |
|
| 85 | 85 | app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization')); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | return $request->wantsJson() |
| 102 | 102 | ? new Response('', 201) |
| 103 | 103 | : redirect($this->redirectPath()); |
| 104 | - }catch (ValidationException $e) { |
|
| 104 | + } catch (ValidationException $e) { |
|
| 105 | 105 | $attributes = $e->validator->attributes(); |
| 106 | 106 | $attributes['provider'] = $provider; |
| 107 | 107 | return redirect()->route('register-social-network') |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | return $request->wantsJson() |
| 102 | 102 | ? new Response('', 201) |
| 103 | 103 | : redirect($this->redirectPath()); |
| 104 | - }catch (ValidationException $e) { |
|
| 104 | + } catch (ValidationException $e) { |
|
| 105 | 105 | $attributes = $e->validator->attributes(); |
| 106 | 106 | $attributes['provider'] = $provider; |
| 107 | 107 | return redirect()->route('register-social-network') |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | ->select() |
| 30 | 30 | ->where('hash', $hash) |
| 31 | 31 | ->first(); |
| 32 | - if(!isset($record)){ |
|
| 32 | + if (!isset($record)) { |
|
| 33 | 33 | return null; |
| 34 | 34 | } |
| 35 | 35 | return new Invitation($record->organization_id, $record->email, $record->firstname, $record->lastname); |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | $this->invitations[] = $i; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getByHash(string $hash):?Invitation |
|
| 19 | + public function getByHash(string $hash): ?Invitation |
|
| 20 | 20 | { |
| 21 | - foreach ($this->invitations as $invitation){ |
|
| 22 | - if($invitation->hash() === $hash){ |
|
| 21 | + foreach ($this->invitations as $invitation) { |
|
| 22 | + if ($invitation->hash() === $hash) { |
|
| 23 | 23 | return $invitation; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -16,20 +16,20 @@ discard block |
||
| 16 | 16 | $this->users[] = $u; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getByEmail(string $email):?User |
|
| 19 | + public function getByEmail(string $email): ?User |
|
| 20 | 20 | { |
| 21 | - foreach ($this->users as $user){ |
|
| 22 | - if($user->email() === $email){ |
|
| 21 | + foreach ($this->users as $user) { |
|
| 22 | + if ($user->email() === $email) { |
|
| 23 | 23 | return $user; |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | return null; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function getById(string $id):?User |
|
| 29 | + public function getById(string $id): ?User |
|
| 30 | 30 | { |
| 31 | - foreach ($this->users as $user){ |
|
| 32 | - if($user->id() === $id){ |
|
| 31 | + foreach ($this->users as $user) { |
|
| 32 | + if ($user->id() === $id) { |
|
| 33 | 33 | return $user; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | public function search(string $organizationId, int $page, int $perPage = 10): array |
| 40 | 40 | { |
| 41 | 41 | $users = []; |
| 42 | - foreach($this->users as $user){ |
|
| 43 | - if($user->organizationId() === $organizationId){ |
|
| 42 | + foreach ($this->users as $user) { |
|
| 43 | + if ($user->organizationId() === $organizationId) { |
|
| 44 | 44 | $users[] = $user->toDto(); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function update(User $u) |
| 56 | 56 | { |
| 57 | - foreach ($this->users as $key => $user){ |
|
| 58 | - if($user->id() === $u->id()){ |
|
| 57 | + foreach ($this->users as $key => $user) { |
|
| 58 | + if ($user->id() === $u->id()) { |
|
| 59 | 59 | $this->users[$key] = $u; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function delete(string $userId) |
| 65 | 65 | { |
| 66 | - foreach ($this->users as $key => $user){ |
|
| 67 | - if($user->id() === $userId){ |
|
| 66 | + foreach ($this->users as $key => $user) { |
|
| 67 | + if ($user->id() === $userId) { |
|
| 68 | 68 | unset($this->users[$key]); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | public function getAdminOfOrganization(string $organizationId): array |
| 74 | 74 | { |
| 75 | 75 | $users = []; |
| 76 | - foreach ($this->users as $key => $user){ |
|
| 77 | - if($user->organizationId() === $organizationId && $user->isAdmin()){ |
|
| 76 | + foreach ($this->users as $key => $user) { |
|
| 77 | + if ($user->organizationId() === $organizationId && $user->isAdmin()) { |
|
| 78 | 78 | $users[] = $user; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function getByProvider(string $provider, string $providerId): ?User |
| 85 | 85 | { |
| 86 | - foreach ($this->users as $user){ |
|
| 87 | - if($user->provider($provider, $providerId) === true){ |
|
| 86 | + foreach ($this->users as $user) { |
|
| 87 | + if ($user->provider($provider, $providerId) === true) { |
|
| 88 | 88 | return $user; |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -9,5 +9,5 @@ |
||
| 9 | 9 | interface InvitationRepository |
| 10 | 10 | { |
| 11 | 11 | public function add(Invitation $i); |
| 12 | - public function getByHash(string $hash):?Invitation; |
|
| 12 | + public function getByHash(string $hash): ?Invitation; |
|
| 13 | 13 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $invitations = []; |
| 31 | 31 | $organization = $this->organizationRepository->get($organizationId); |
| 32 | - foreach($users as $user){ |
|
| 32 | + foreach ($users as $user) { |
|
| 33 | 33 | $email = $user['email']; |
| 34 | 34 | $firstname = isset($user['firstname']) ? $user['firstname'] : ''; |
| 35 | 35 | $lastname = isset($user['lastname']) ? $user['lastname'] : ''; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function adminlte_image() |
| 30 | 30 | { |
| 31 | 31 | $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null; |
| 32 | - if(!isset($urlPicture) || $urlPicture === ""){ |
|
| 32 | + if (!isset($urlPicture) || $urlPicture === "") { |
|
| 33 | 33 | $urlPicture = url('').'/'.config('adminlte.logo_img'); |
| 34 | 34 | } |
| 35 | 35 | return $urlPicture; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function adminlte_desc() |
| 39 | 39 | { |
| 40 | 40 | $desc = ucfirst($this->firstname).' '.ucfirst($this->lastname); |
| 41 | - if($this->organization_id !== null){ |
|
| 41 | + if ($this->organization_id !== null) { |
|
| 42 | 42 | $organization = app(OrganizationRepository::class)->get($this->organization_id); |
| 43 | 43 | $desc .= ' - organisme : '.$organization->name(); |
| 44 | 44 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | public function register() |
| 34 | 34 | { |
| 35 | - if(config('app.env') === 'testing'){ |
|
| 35 | + if (config('app.env') === 'testing') { |
|
| 36 | 36 | $this->app->singleton(OrganizationRepository::class, InMemoryOrganizationRepository::class); |
| 37 | 37 | $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class); |
| 38 | 38 | $this->app->singleton(UserRepository::class, InMemoryUserRepository::class); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $this->app->singleton(HashGen::class, InMemoryHashGen::class); |
| 43 | 43 | $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class); |
| 44 | 44 | } |
| 45 | - if(config('app.env') === 'testing-ti'){ |
|
| 45 | + if (config('app.env') === 'testing-ti') { |
|
| 46 | 46 | $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class); |
| 47 | 47 | $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class); |
| 48 | 48 | $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->app->singleton(SocialiteGateway::class, InMemorySocialiteGateway::class); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(config('app.env') === 'local'){ |
|
| 56 | + if (config('app.env') === 'local') { |
|
| 57 | 57 | $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class); |
| 58 | 58 | $this->app->singleton(InvitationRepository::class, InvitationRepositorySql::class); |
| 59 | 59 | $this->app->singleton(PictureHandler::class, StoragePictureHandler::class); |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function listUsers(string $organizationId, Request $request, ListUsers $listUsers) |
| 27 | 27 | { |
| 28 | - $page = $request->input('start')/10 + 1; |
|
| 28 | + $page = $request->input('start')/10+1; |
|
| 29 | 29 | |
| 30 | 30 | $users = $listUsers->list($organizationId, $page, 10); |
| 31 | 31 | $total = isset($users['total']) ? $users['total'] : 0; |
| 32 | 32 | $list = []; |
| 33 | - foreach ($users['list'] as $user){ |
|
| 33 | + foreach ($users['list'] as $user) { |
|
| 34 | 34 | $user = $user->toArray(); |
| 35 | 35 | $list[] = [ |
| 36 | 36 | '', |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization, GetUserStats $getUserStats) |
| 56 | 56 | { |
| 57 | 57 | $user = $getUser->get($userId); |
| 58 | - if($user->organizationId() !== null) { |
|
| 58 | + if ($user->organizationId() !== null) { |
|
| 59 | 59 | $organization = $getOrganization->get($user->organizationId()); |
| 60 | 60 | } |
| 61 | 61 | $stats = $getUserStats->get($userId); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $lastname = $request->input('lastname') !== null ? $request->input('lastname') : ''; |
| 74 | 74 | $email = $request->input('email') !== null ? $request->input('email') : ''; |
| 75 | 75 | $picture = []; |
| 76 | - if($request->has('logo')){ |
|
| 76 | + if ($request->has('logo')) { |
|
| 77 | 77 | $picture['path_picture'] = $request->file('logo')->path(); |
| 78 | 78 | $picture['original_name'] = $request->file('logo')->getClientOriginalName(); |
| 79 | 79 | $picture['mine_type'] = $request->file('logo')->getMimeType(); |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | public function delete(string $userId, Request $request, DeleteUser $deleteUser) |
| 101 | 101 | { |
| 102 | 102 | $redirect = 'back'; |
| 103 | - if($userId === Auth::id()){ |
|
| 103 | + if ($userId === Auth::id()) { |
|
| 104 | 104 | $redirect = 'login'; |
| 105 | 105 | } |
| 106 | 106 | $deleteUser->delete($userId); |
| 107 | - if($redirect === 'login') { |
|
| 107 | + if ($redirect === 'login') { |
|
| 108 | 108 | return redirect()->route('login'); |
| 109 | 109 | } |
| 110 | 110 | $request->session()->flash('notif_msg', 'L\'utilisateur a été supprimé'); |