@@ -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é'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function showEditProfile(GetUser $getUser, GetOrganization $getOrganization, GetUserStats $getUserStats) |
17 | 17 | { |
18 | 18 | $user = $getUser->get(Auth::user()->uuid); |
19 | - if($user->organizationId() !== null) { |
|
19 | + if ($user->organizationId() !== null) { |
|
20 | 20 | $organization = $getOrganization->get($user->organizationId()); |
21 | 21 | } |
22 | 22 | $stats = $getUserStats->get(Auth::user()->uuid); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $lastname = $request->input('lastname') !== null ? $request->input('lastname') : ''; |
36 | 36 | $email = $request->input('email') !== null ? $request->input('email') : ''; |
37 | 37 | $picture = []; |
38 | - if($request->has('logo')){ |
|
38 | + if ($request->has('logo')) { |
|
39 | 39 | $picture['path_picture'] = $request->file('logo')->path(); |
40 | 40 | $picture['original_name'] = $request->file('logo')->getClientOriginalName(); |
41 | 41 | $picture['mine_type'] = $request->file('logo')->getMimeType(); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function getByEmail(string $email): ?User |
18 | 18 | { |
19 | 19 | $record = \App\User::where('email', $email)->first(); |
20 | - if(!isset($record)){ |
|
20 | + if (!isset($record)) { |
|
21 | 21 | return null; |
22 | 22 | } |
23 | 23 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function getById(string $id): ?User |
28 | 28 | { |
29 | 29 | $record = \App\User::where('uuid', $id)->first(); |
30 | - if(!isset($record)){ |
|
30 | + if (!isset($record)) { |
|
31 | 31 | return null; |
32 | 32 | } |
33 | 33 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | ->offset(($page-1)*$perPage) |
84 | 84 | ->limit($perPage) |
85 | 85 | ->get(); |
86 | - if(empty($records)){ |
|
86 | + if (empty($records)) { |
|
87 | 87 | return []; |
88 | 88 | } |
89 | 89 | |
90 | 90 | $users = []; |
91 | - foreach($records as $record){ |
|
92 | - if($record->uuid === null){ |
|
91 | + foreach ($records as $record) { |
|
92 | + if ($record->uuid === null) { |
|
93 | 93 | $identity = new Identity(Uuid::uuid4(), $record->iemail, $record->ifirstname, $record->ilastname, null); |
94 | 94 | $state = new State($organizationId, null, false, []); |
95 | 95 | $users[] = new UserDto($identity, $state); |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | public function getAdminOfOrganization(string $organizationId): array |
116 | 116 | { |
117 | 117 | $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get(); |
118 | - if(empty($records)){ |
|
118 | + if (empty($records)) { |
|
119 | 119 | return []; |
120 | 120 | } |
121 | 121 | $users = []; |
122 | - foreach($records as $record){ |
|
122 | + foreach ($records as $record) { |
|
123 | 123 | $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray(); |
124 | 124 | $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles); |
125 | 125 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function getByProvider(string $provider, string $providerId): ?User |
130 | 130 | { |
131 | 131 | $record = \App\User::where('providers->'.$provider, $providerId)->first(); |
132 | - if(!isset($record)){ |
|
132 | + if (!isset($record)) { |
|
133 | 133 | return null; |
134 | 134 | } |
135 | 135 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function getStats(string $userId): Stats |
140 | 140 | { |
141 | 141 | $record = \App\User::where('uuid', $userId)->first(); |
142 | - if(isset($record) && $record->wiki_stats !== null){ |
|
142 | + if (isset($record) && $record->wiki_stats !== null) { |
|
143 | 143 | return new Stats($record->wiki_stats); |
144 | 144 | } |
145 | 145 | return new Stats([]); |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $socialiteUser = $this->socialiteGateway->user($provider); |
42 | 42 | |
43 | 43 | $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId()); |
44 | - if($user === null){ |
|
44 | + if ($user === null) { |
|
45 | 45 | throw ValidationException::withMessages([ |
46 | 46 | 'email' => [trans('auth.failed')], |
47 | 47 | ]); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function __construct(array $data) |
22 | 22 | { |
23 | - foreach ($this->fields as $field){ |
|
23 | + foreach ($this->fields as $field) { |
|
24 | 24 | $this->stats[$field] = $this->dataOrZero($field, $data); |
25 | 25 | } |
26 | 26 | } |