@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | protected function redirectTo($request) |
16 | 16 | { |
17 | - if (! $request->expectsJson()) { |
|
17 | + if (!$request->expectsJson()) { |
|
18 | 18 | return route('login'); |
19 | 19 | } |
20 | 20 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'city' => $city, |
36 | 36 | ]; |
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(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'city' => $city, |
68 | 68 | ]; |
69 | 69 | $picture = []; |
70 | - if($request->has('logo')){ |
|
70 | + if ($request->has('logo')) { |
|
71 | 71 | $picture['path_picture'] = $request->file('logo')->path(); |
72 | 72 | $picture['original_name'] = $request->file('logo')->getClientOriginalName(); |
73 | 73 | $picture['mine_type'] = $request->file('logo')->getMimeType(); |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | |
86 | 86 | public function listOrganizations(Request $request, ListOrganizations $listOrganizations) |
87 | 87 | { |
88 | - $page = $request->input('start')/10 + 1; |
|
88 | + $page = $request->input('start')/10+1; |
|
89 | 89 | $organizations = $listOrganizations->list($page, 10); |
90 | 90 | $total = isset($organizations['total']) ? $organizations['total'] : 0; |
91 | 91 | $list = []; |
92 | - foreach ($organizations['list'] as $organization){ |
|
92 | + foreach ($organizations['list'] as $organization) { |
|
93 | 93 | $org = $organization->toArray(); |
94 | 94 | $list[] = [ |
95 | 95 | $org['name'], |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ]; |
109 | 109 | } |
110 | 110 | |
111 | - public function prepareInvitation(Request $request, PrepareInvitationUsersInOrganization $prepareInvitationUsersInOrganization) |
|
111 | + public function prepareInvitation(Request $request, PrepareInvitationUsersInOrganization $prepareInvitationUsersInOrganization) |
|
112 | 112 | { |
113 | 113 | $users = $request->input('users'); |
114 | 114 | $users = explode(PHP_EOL, $users); |
@@ -135,19 +135,19 @@ discard block |
||
135 | 135 | public function acceptInvite(Request $request, RespondInvitationToAnOrganization $respondInvitationToAnOrganization) |
136 | 136 | { |
137 | 137 | $action = $respondInvitationToAnOrganization->respond($token = $request->input('token')); |
138 | - if($action['action'] == 'register'){ |
|
138 | + if ($action['action'] == 'register') { |
|
139 | 139 | $request->session()->flash('should_attach_to_organization', $action['organization_id']); |
140 | 140 | $request->session()->flash('user_to_register', $action['user']); |
141 | 141 | return redirect()->route('register'); |
142 | 142 | } |
143 | - if($action['action'] == 'accept_or_decline'){ |
|
143 | + if ($action['action'] == 'accept_or_decline') { |
|
144 | 144 | $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id()); |
145 | 145 | return view('organizations.accept-or-decline-invitation', [ |
146 | 146 | 'old_organisation' => isset($action['old_organisation']) ? $action['old_organisation']->toArray() : null, |
147 | 147 | 'organization_to_join' => isset($action['organization_to_join']) ? $action['organization_to_join']->toArray() : null |
148 | 148 | ]); |
149 | 149 | } |
150 | - if($action['action'] == 'logout-login'){ |
|
150 | + if ($action['action'] == 'logout-login') { |
|
151 | 151 | $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id()); |
152 | 152 | $request->session()->flash('should_attach_to_organization_token', $token); |
153 | 153 | $request->session()->flash('should_attach_to_organization_redirect', route('login')); |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | ]); |
157 | 157 | } |
158 | 158 | |
159 | - if($action['action'] == 'login'){ |
|
159 | + if ($action['action'] == 'login') { |
|
160 | 160 | $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id()); |
161 | 161 | $request->session()->flash('should_attach_to_organization_token', $token); |
162 | 162 | $request->session()->flash('should_attach_to_organization_redirect', route('login')); |
163 | 163 | return redirect()->route('login'); |
164 | 164 | } |
165 | 165 | |
166 | - if($action['action'] == 'logout-register'){ |
|
166 | + if ($action['action'] == 'logout-register') { |
|
167 | 167 | $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id()); |
168 | 168 | $request->session()->flash('should_attach_to_organization_token', $token); |
169 | 169 | $request->session()->flash('should_attach_to_organization_redirect', route('register')); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function logout(Request $request) |
30 | 30 | { |
31 | - if($request->session()->has('should_attach_to_organization')) { |
|
31 | + if ($request->session()->has('should_attach_to_organization')) { |
|
32 | 32 | $shouldAttach = $request->session()->get('should_attach_to_organization'); |
33 | 33 | $shouldAttachToken = $request->session()->get('should_attach_to_organization_token'); |
34 | 34 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $request->session()->regenerateToken(); |
42 | 42 | |
43 | - if(isset($shouldAttach)){ |
|
43 | + if (isset($shouldAttach)) { |
|
44 | 44 | $request->session()->flash('should_attach_to_organization', $shouldAttach); |
45 | 45 | $request->session()->flash('should_attach_to_organization_token', $shouldAttachToken); |
46 | 46 | $request->session()->flash('should_attach_to_organization_redirect', $linkToRedirect); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | protected function loggedOut(Request $request) |
59 | 59 | { |
60 | 60 | $request->session()->reflash(); |
61 | - if($request->session()->has('should_attach_to_organization')){ |
|
61 | + if ($request->session()->has('should_attach_to_organization')) { |
|
62 | 62 | $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect'); |
63 | 63 | return $request->wantsJson() |
64 | 64 | ? new Response('', 204) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | protected function authenticated(Request $request, $user) |
70 | 70 | { |
71 | - if($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null){ |
|
71 | + if ($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null) { |
|
72 | 72 | $token = $request->session()->get('should_attach_to_organization_token'); |
73 | 73 | $link = route('organization.invite.show').'?&token='.$token; |
74 | 74 | return $request->wantsJson() |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | { |
12 | 12 | private $organizations = []; |
13 | 13 | |
14 | - public function get(string $id):? Organization |
|
14 | + public function get(string $id): ? Organization |
|
15 | 15 | { |
16 | - foreach ($this->organizations as $organization){ |
|
17 | - if($organization->id() === $id){ |
|
16 | + foreach ($this->organizations as $organization) { |
|
17 | + if ($organization->id() === $id) { |
|
18 | 18 | return $organization; |
19 | 19 | } |
20 | 20 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | public function update(Organization $o) |
40 | 40 | { |
41 | - foreach ($this->organizations as $key => $organization){ |
|
42 | - if($organization->id() === $o->id()){ |
|
41 | + foreach ($this->organizations as $key => $organization) { |
|
42 | + if ($organization->id() === $o->id()) { |
|
43 | 43 | $this->organizations[$key] = $organization; |
44 | 44 | } |
45 | 45 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public function current(): ?User |
13 | 13 | { |
14 | 14 | $userModel = Auth::user(); |
15 | - if(!isset($userModel)){ |
|
15 | + if (!isset($userModel)) { |
|
16 | 16 | return null; |
17 | 17 | } |
18 | 18 | return new User($userModel->uuid, $userModel->email, $userModel->firstname, $userModel->lastname, $userModel->organization_id); |
@@ -8,6 +8,6 @@ |
||
8 | 8 | |
9 | 9 | interface AuthGateway |
10 | 10 | { |
11 | - public function current():? User; |
|
11 | + public function current(): ? User; |
|
12 | 12 | public function log(User $u); |
13 | 13 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | ->select() |
18 | 18 | ->where('uuid', $id) |
19 | 19 | ->first(); |
20 | - if(!isset($record)){ |
|
20 | + if (!isset($record)) { |
|
21 | 21 | return null; |
22 | 22 | } |
23 | 23 | $address = new Address($record->city, $record->address1, $record->address2, $record->postal_code); |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | ->offset(($page-1)*$perPage) |
43 | 43 | ->limit($perPage) |
44 | 44 | ->get(); |
45 | - if(empty($records)){ |
|
45 | + if (empty($records)) { |
|
46 | 46 | return []; |
47 | 47 | } |
48 | 48 | $organizations = []; |
49 | - foreach($records as $record){ |
|
49 | + foreach ($records as $record) { |
|
50 | 50 | $address = new Address($record->city, $record->address1, $record->address2, $record->postal_code); |
51 | 51 | $organizations[] = new Organization($record->uuid, $record->name, $record->path_picture, $address); |
52 | 52 | } |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | $usersToProcess = []; |
24 | 24 | $usersLoop = $this->getUsersToProcess($users, $usersLoop, $filePathUsers); |
25 | 25 | $errors = $imported = 0; |
26 | - foreach($usersLoop as $userToInvite){ |
|
26 | + foreach ($usersLoop as $userToInvite) { |
|
27 | 27 | $rules = [ |
28 | 28 | 'email' => 'email|required|min:2|max:255', |
29 | 29 | 'firstname' => 'string|max:100', |
30 | 30 | 'lastname' => 'string|max:100', |
31 | 31 | ]; |
32 | 32 | $validator = Validator::make($userToInvite, $rules); |
33 | - if($validator->fails()){ |
|
33 | + if ($validator->fails()) { |
|
34 | 34 | $userToInvite['error'] = 'email.error.syntax'; |
35 | 35 | $usersToProcess['users'][] = $userToInvite; |
36 | 36 | $errors++; |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | $user = $this->userRepository->getByEmail($userToInvite['email']); |
41 | - if(isset($user) && $user->organizationId() === $organizationId) { |
|
41 | + if (isset($user) && $user->organizationId() === $organizationId) { |
|
42 | 42 | $userToInvite["error"] = 'already_in'; |
43 | 43 | $errors++; |
44 | 44 | } |
45 | 45 | $usersToProcess['users'][] = $userToInvite; |
46 | 46 | |
47 | - if(!isset($userToInvite["error"])){ |
|
47 | + if (!isset($userToInvite["error"])) { |
|
48 | 48 | $imported++; |
49 | 49 | } |
50 | 50 | } |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | |
34 | 34 | public function create(string $ext = 'jpg') |
35 | 35 | { |
36 | - if($this->pathPicture !== "") { |
|
36 | + if ($this->pathPicture !== "") { |
|
37 | 37 | $picture = new Picture($this->pathPicture); |
38 | - $picture->resize('app/public/organizations/' . $this->id . '.' . $ext); |
|
39 | - $this->pathPicture = 'app/public/organizations/' . $this->id . '.' . $ext; |
|
38 | + $picture->resize('app/public/organizations/'.$this->id.'.'.$ext); |
|
39 | + $this->pathPicture = 'app/public/organizations/'.$this->id.'.'.$ext; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | app(OrganizationRepository::class)->add($this); |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->name = $name; |
48 | 48 | $this->address = $address; |
49 | - if($picture['path'] !== "") { |
|
49 | + if ($picture['path'] !== "") { |
|
50 | 50 | $logo = new Picture($picture['path']); |
51 | 51 | $ext = $picture['ext']; |
52 | - $logo->resize('app/public/organizations/' . $this->id . '.' . $ext); |
|
53 | - $this->pathPicture = 'app/public/organizations/' . $this->id . '.' . $ext; |
|
52 | + $logo->resize('app/public/organizations/'.$this->id.'.'.$ext); |
|
53 | + $this->pathPicture = 'app/public/organizations/'.$this->id.'.'.$ext; |
|
54 | 54 | } |
55 | 55 | app(OrganizationRepository::class)->update($this); |
56 | 56 | } |