@@ -38,7 +38,7 @@ |
||
38 | 38 | // need to show to the user. Finally, we'll send out a proper response. |
39 | 39 | $response = $this->broker()->sendResetLink( |
40 | 40 | $this->credentials($request), |
41 | - function ($user, $token){ |
|
41 | + function($user, $token) { |
|
42 | 42 | Mail::to($user->email) |
43 | 43 | ->send(new PasswordResetLink($user, $token)); |
44 | 44 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function get() |
9 | 9 | { |
10 | - return collect([ |
|
10 | + return collect([ |
|
11 | 11 | new WikiUserRole('advisor'), |
12 | 12 | new WikiUserRole('farmer'), |
13 | 13 | new WikiUserRole('student'), |
@@ -106,7 +106,7 @@ |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | return redirect()->route('wizard.profile'); |
109 | - }catch (ValidationException $e) { |
|
109 | + } catch (ValidationException $e) { |
|
110 | 110 | $attributes = $e->validator->attributes(); |
111 | 111 | $attributes['provider'] = $provider; |
112 | 112 | return redirect()->route('register-social-network') |
@@ -31,13 +31,13 @@ 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']; |
38 | 38 | $lastname = $user['lastname']; |
39 | 39 | } |
40 | - if(session()->has('should_attach_to_organization')) { |
|
40 | + if (session()->has('should_attach_to_organization')) { |
|
41 | 41 | session()->reflash(); |
42 | 42 | } |
43 | 43 | return view('public.auth.register', [ |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function validator(array $data) |
51 | 51 | { |
52 | - if(session()->has('should_attach_to_organization')) { |
|
52 | + if (session()->has('should_attach_to_organization')) { |
|
53 | 53 | session()->reflash(); |
54 | 54 | } |
55 | 55 | return Validator::make($data, [ |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | |
74 | 74 | protected function registered(Request $request, $user) |
75 | 75 | { |
76 | - if($request->session()->has('should_attach_to_organization')){ |
|
76 | + if ($request->session()->has('should_attach_to_organization')) { |
|
77 | 77 | app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization')); |
78 | 78 | } |
79 | 79 | $user = Auth::user(); |
80 | 80 | |
81 | - if($user->context_id === null) { |
|
81 | + if ($user->context_id === null) { |
|
82 | 82 | return redirect()->route('wizard.profile'); |
83 | 83 | } |
84 | 84 | |
85 | - if($request->session()->has('wiki_callback')){ |
|
85 | + if ($request->session()->has('wiki_callback')) { |
|
86 | 86 | $user->wiki_token = $request->session()->get('wiki_token'); |
87 | 87 | $user->save(); |
88 | 88 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function redirectToProvider(string $provider) |
96 | 96 | { |
97 | 97 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
98 | - if($provider === 'twitter'){ |
|
98 | + if ($provider === 'twitter') { |
|
99 | 99 | return Socialite::driver($provider)->redirect(); |
100 | 100 | } |
101 | 101 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $user = User::where('uuid', $userId)->first(); |
109 | 109 | $this->guard()->login($user); |
110 | 110 | |
111 | - if($user->context_id !== null){ |
|
111 | + if ($user->context_id !== null) { |
|
112 | 112 | $user->wiki_token = $request->session()->get('wiki_token'); |
113 | 113 | $user->save(); |
114 | 114 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | return redirect()->route('wizard.profile'); |
119 | - }catch (ValidationException $e) { |
|
119 | + } catch (ValidationException $e) { |
|
120 | 120 | $attributes = $e->validator->attributes(); |
121 | 121 | $attributes['provider'] = $provider; |
122 | 122 | return redirect()->route('register-social-network') |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $farmingType = $request->input('farming_type') !== null ? $request->input('farming_type') : []; |
40 | 40 | |
41 | 41 | $fillWikiUserProfile->fill(Auth::user()->uuid, $role, $firstname, $lastname, $email, $postalCode, $farmingType); |
42 | - if(session()->has('wiki_callback')){ |
|
42 | + if (session()->has('wiki_callback')) { |
|
43 | 43 | $user = Auth::user(); |
44 | 44 | $user->wiki_token = session()->get('wiki_token'); |
45 | 45 | $user->save(); |
@@ -11,11 +11,11 @@ |
||
11 | 11 | |
12 | 12 | class ContextRepositorySql implements ContextRepository |
13 | 13 | { |
14 | - public function getByUser(string $userId):?Context |
|
14 | + public function getByUser(string $userId): ?Context |
|
15 | 15 | { |
16 | 16 | $user = User::where('uuid', $userId)->first(); |
17 | 17 | $context = DB::table('contexts')->where('id', $user->context_id)->first(); |
18 | - if($context == null){ |
|
18 | + if ($context == null) { |
|
19 | 19 | return null; |
20 | 20 | } |
21 | 21 | return new Context($context->uuid, $context->postal_code, json_decode($context->farmings, true)); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function register(string $provider, SocialiteUser $socialiteUser) |
30 | 30 | { |
31 | 31 | $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId()); |
32 | - if(isset($user)){ |
|
32 | + if (isset($user)) { |
|
33 | 33 | return [ |
34 | 34 | 'user_id' => $user->id(), |
35 | 35 | 'provider_id' => $socialiteUser->providerId(), |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | ]; |
38 | 38 | } |
39 | 39 | |
40 | - if($socialiteUser->email() !== null && $socialiteUser->email() != "") { |
|
40 | + if ($socialiteUser->email() !== null && $socialiteUser->email() != "") { |
|
41 | 41 | $user = $this->userRepository->getByEmail($socialiteUser->email()); |
42 | 42 | } |
43 | - if(isset($user)){ |
|
43 | + if (isset($user)) { |
|
44 | 44 | $user->addProvider($provider, $socialiteUser->providerId()); |
45 | 45 | return [ |
46 | 46 | 'user_id' => $user->id(), |
@@ -11,10 +11,10 @@ |
||
11 | 11 | public function handle($request, \Closure $next) |
12 | 12 | { |
13 | 13 | $user = Auth::user(); |
14 | - if($user->context_id === null){ |
|
14 | + if ($user->context_id === null) { |
|
15 | 15 | return $next($request); |
16 | 16 | } |
17 | - if(session()->has('wiki_callback')){ |
|
17 | + if (session()->has('wiki_callback')) { |
|
18 | 18 | $user->wiki_token = session()->get('wiki_token'); |
19 | 19 | $user->save(); |
20 | 20 | $callback = urldecode(session()->get('wiki_callback')); |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | { |
16 | 16 | $token = $request->input('wiki_token', null); |
17 | 17 | |
18 | - if($token === null || $token === ''){ |
|
18 | + if ($token === null || $token === '') { |
|
19 | 19 | return ['error' => 'invalid_token']; |
20 | 20 | } |
21 | 21 | $user = User::where('wiki_token', $token)->first(); |
22 | 22 | |
23 | - if($user === null){ |
|
23 | + if ($user === null) { |
|
24 | 24 | return ['error' => 'invalid_token']; |
25 | 25 | } |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function logout() |
37 | 37 | { |
38 | 38 | $user = Auth::user(); |
39 | - if(isset($user)){ |
|
39 | + if (isset($user)) { |
|
40 | 40 | $user->wiki_token = ''; |
41 | 41 | $user->save(); |
42 | 42 | Auth::logout(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $errors = []; |
29 | 29 | $user = $this->userRepository->getByEmail($email); |
30 | - if(isset($user) && $user->id() !== $userId){ |
|
30 | + if (isset($user) && $user->id() !== $userId) { |
|
31 | 31 | $errors[] = ['validation.unique']; |
32 | 32 | } |
33 | 33 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'email' => $email |
61 | 61 | ], $rules); |
62 | 62 | |
63 | - $validator->after(function () use ($validator, $errors) { |
|
63 | + $validator->after(function() use ($validator, $errors) { |
|
64 | 64 | foreach ($errors as $field => $error) { |
65 | 65 | $validator->errors()->add($field, $error); |
66 | 66 | } |