@@ -12,7 +12,7 @@ discard block  | 
                                                    ||
| 12 | 12 | public function getByEmail(string $email): ?User  | 
                                                        
| 13 | 13 |      { | 
                                                        
| 14 | 14 |          $record = \App\User::where('email', $email)->first(); | 
                                                        
| 15 | -        if(!isset($record)){ | 
                                                        |
| 15 | +        if (!isset($record)) { | 
                                                        |
| 16 | 16 | return null;  | 
                                                        
| 17 | 17 | }  | 
                                                        
| 18 | 18 |          $roles = $record->roles()->pluck('name')->toArray(); | 
                                                        
@@ -22,7 +22,7 @@ discard block  | 
                                                    ||
| 22 | 22 | public function getById(string $id): ?User  | 
                                                        
| 23 | 23 |      { | 
                                                        
| 24 | 24 |          $record = \App\User::where('uuid', $id)->first(); | 
                                                        
| 25 | -        if(!isset($record)){ | 
                                                        |
| 25 | +        if (!isset($record)) { | 
                                                        |
| 26 | 26 | return null;  | 
                                                        
| 27 | 27 | }  | 
                                                        
| 28 | 28 |          $roles = $record->roles()->pluck('name')->toArray(); | 
                                                        
@@ -67,11 +67,11 @@ discard block  | 
                                                    ||
| 67 | 67 | ->offset(($page-1)*$perPage)  | 
                                                        
| 68 | 68 | ->limit($perPage)  | 
                                                        
| 69 | 69 | ->get();  | 
                                                        
| 70 | -        if(empty($records)){ | 
                                                        |
| 70 | +        if (empty($records)) { | 
                                                        |
| 71 | 71 | return [];  | 
                                                        
| 72 | 72 | }  | 
                                                        
| 73 | 73 | $users = [];  | 
                                                        
| 74 | -        foreach($records as $record){ | 
                                                        |
| 74 | +        foreach ($records as $record) { | 
                                                        |
| 75 | 75 |              $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray(); | 
                                                        
| 76 | 76 | $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles);  | 
                                                        
| 77 | 77 | }  | 
                                                        
@@ -90,11 +90,11 @@ discard block  | 
                                                    ||
| 90 | 90 | public function getAdminOfOrganization(string $organizationId): array  | 
                                                        
| 91 | 91 |      { | 
                                                        
| 92 | 92 |          $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get(); | 
                                                        
| 93 | -        if(empty($records)){ | 
                                                        |
| 93 | +        if (empty($records)) { | 
                                                        |
| 94 | 94 | return [];  | 
                                                        
| 95 | 95 | }  | 
                                                        
| 96 | 96 | $users = [];  | 
                                                        
| 97 | -        foreach($records as $record){ | 
                                                        |
| 97 | +        foreach ($records as $record) { | 
                                                        |
| 98 | 98 |              $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray(); | 
                                                        
| 99 | 99 | $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles);  | 
                                                        
| 100 | 100 | }  | 
                                                        
@@ -24,12 +24,12 @@ discard block  | 
                                                    ||
| 24 | 24 | |
| 25 | 25 | public function listUsers(string $organizationId, Request $request, ListUsers $listUsers)  | 
                                                        
| 26 | 26 |      { | 
                                                        
| 27 | -        $page = $request->input('start')/10 + 1; | 
                                                        |
| 27 | +        $page = $request->input('start')/10+1; | 
                                                        |
| 28 | 28 | |
| 29 | 29 | $users = $listUsers->list($organizationId, $page, 10);  | 
                                                        
| 30 | 30 | $total = isset($users['total']) ? $users['total'] : 0;  | 
                                                        
| 31 | 31 | $list = [];  | 
                                                        
| 32 | -        foreach ($users['list'] as $user){ | 
                                                        |
| 32 | +        foreach ($users['list'] as $user) { | 
                                                        |
| 33 | 33 | $user = $user->toArray();  | 
                                                        
| 34 | 34 | $list[] = [  | 
                                                        
| 35 | 35 | '',  | 
                                                        
@@ -54,7 +54,7 @@ discard block  | 
                                                    ||
| 54 | 54 | public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization)  | 
                                                        
| 55 | 55 |      { | 
                                                        
| 56 | 56 | $user = $getUser->get($userId);  | 
                                                        
| 57 | -        if($user->organizationId() !== null) { | 
                                                        |
| 57 | +        if ($user->organizationId() !== null) { | 
                                                        |
| 58 | 58 | $organization = $getOrganization->get($user->organizationId());  | 
                                                        
| 59 | 59 | }  | 
                                                        
| 60 | 60 |          return view('users/edit_form', [ | 
                                                        
@@ -69,7 +69,7 @@ discard block  | 
                                                    ||
| 69 | 69 |          $lastname = $request->input('lastname') !== null ? $request->input('lastname') : ''; | 
                                                        
| 70 | 70 |          $email = $request->input('email') !== null ? $request->input('email') : ''; | 
                                                        
| 71 | 71 | $picture = [];  | 
                                                        
| 72 | -        if($request->has('logo')){ | 
                                                        |
| 72 | +        if ($request->has('logo')) { | 
                                                        |
| 73 | 73 |              $picture['path_picture'] = $request->file('logo')->path(); | 
                                                        
| 74 | 74 |              $picture['original_name'] = $request->file('logo')->getClientOriginalName(); | 
                                                        
| 75 | 75 |              $picture['mine_type'] = $request->file('logo')->getMimeType(); | 
                                                        
@@ -96,11 +96,11 @@ discard block  | 
                                                    ||
| 96 | 96 | public function delete(string $userId, Request $request, DeleteUser $deleteUser)  | 
                                                        
| 97 | 97 |      { | 
                                                        
| 98 | 98 | $redirect = 'back';  | 
                                                        
| 99 | -        if($userId === Auth::id()){ | 
                                                        |
| 99 | +        if ($userId === Auth::id()) { | 
                                                        |
| 100 | 100 | $redirect = 'login';  | 
                                                        
| 101 | 101 | }  | 
                                                        
| 102 | 102 | $deleteUser->delete($userId);  | 
                                                        
| 103 | -        if($redirect === 'login') { | 
                                                        |
| 103 | +        if ($redirect === 'login') { | 
                                                        |
| 104 | 104 |              return redirect()->route('login'); | 
                                                        
| 105 | 105 | }  | 
                                                        
| 106 | 106 |          $request->session()->flash('notif_msg', 'L\'utilisateur a été supprimé'); |