@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | return $list->toArray(); |
32 | 32 | } |
33 | 33 | |
34 | - public function getByPageId(int $pageId):?Characteristic |
|
34 | + public function getByPageId(int $pageId): ?Characteristic |
|
35 | 35 | { |
36 | 36 | $c = CharacteristicsModel::query() |
37 | 37 | ->where('page_id', $pageId) |
38 | 38 | ->first(); |
39 | - if(!isset($c)){ |
|
39 | + if (!isset($c)) { |
|
40 | 40 | return null; |
41 | 41 | } |
42 | 42 | return $c->toDomain(); |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | public function getBy(array $conditions): ?Characteristic |
63 | 63 | { |
64 | 64 | $characteristicModel = CharacteristicsModel::query() |
65 | - ->when(isset($conditions['type']), function ($query) use($conditions){ |
|
65 | + ->when(isset($conditions['type']), function($query) use($conditions){ |
|
66 | 66 | $query->where('type', $conditions['type']); |
67 | 67 | }) |
68 | - ->when(isset($conditions['title']), function ($query) use($conditions){ |
|
68 | + ->when(isset($conditions['title']), function($query) use($conditions){ |
|
69 | 69 | $query->where('code', $conditions['title']); |
70 | 70 | }) |
71 | 71 | ->first(); |
72 | - if(!isset($characteristicModel)){ |
|
72 | + if (!isset($characteristicModel)) { |
|
73 | 73 | return null; |
74 | 74 | } |
75 | 75 | return $characteristicModel->toDomain(); |
@@ -36,9 +36,9 @@ |
||
36 | 36 | $pages = $this->pageRepository->getByIds($pagesIds); |
37 | 37 | |
38 | 38 | $characteristics = []; |
39 | - foreach ($pages as $page){ |
|
39 | + foreach ($pages as $page) { |
|
40 | 40 | $characteristic = $this->characteristicsRepository->getByPageId($page->pageId()); |
41 | - if(!isset($characteristic)){ |
|
41 | + if (!isset($characteristic)) { |
|
42 | 42 | $characteristic = $page->createCharacteristicAssociated(); |
43 | 43 | } |
44 | 44 | $characteristics[] = $characteristic->id(); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $this->contextRepository = $contextRepository; |
17 | 17 | } |
18 | 18 | |
19 | - public function execute(string $userId):?ContextDto |
|
19 | + public function execute(string $userId): ?ContextDto |
|
20 | 20 | { |
21 | 21 | return $this->contextRepository->getByUserDto($userId); |
22 | 22 | } |
@@ -11,7 +11,7 @@ |
||
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 | 17 | return redirect('/profile'); |
@@ -15,11 +15,11 @@ |
||
15 | 15 | */ |
16 | 16 | public function handle($request, Closure $next) |
17 | 17 | { |
18 | - if(session()->has('wiki_callback')){ |
|
18 | + if (session()->has('wiki_callback')) { |
|
19 | 19 | session()->keep(['wiki_callback', 'wiki_token']); |
20 | 20 | } |
21 | 21 | |
22 | - if($request->has('sso')){ |
|
22 | + if ($request->has('sso')) { |
|
23 | 23 | session()->put('sso', $request->get('sso')); |
24 | 24 | session()->put('sig', $request->get('sig')); |
25 | 25 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function handle(Registered $event) |
13 | 13 | { |
14 | - if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { |
|
14 | + if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && !$event->user->hasVerifiedEmail()) { |
|
15 | 15 | $event->user->sendEmailVerificationNotification(); |
16 | 16 | } |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function handle($request, Closure $next) |
12 | 12 | { |
13 | 13 | $user = Auth::user(); |
14 | - if(!$user->hasVerifiedEmail()){ |
|
14 | + if (!$user->hasVerifiedEmail()) { |
|
15 | 15 | $request->session()->flash('from_forum', true); |
16 | 16 | return redirect()->route('verification.notice'); |
17 | 17 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | public function deleted(PageModel $pageModel) |
25 | 25 | { |
26 | - Log::info('Deleting all data from the page internal id: ' . $pageModel->id); |
|
27 | - DB::transaction(function () use($pageModel){ |
|
26 | + Log::info('Deleting all data from the page internal id: '.$pageModel->id); |
|
27 | + DB::transaction(function() use($pageModel){ |
|
28 | 28 | try { |
29 | 29 | $characteristic = CharacteristicsModel::query()->where('page_id', $pageModel->page_id)->first(); |
30 | 30 | if (isset($characteristic)) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | UserCharacteristicsModel::query()->where('characteristic_id', $characteristic->id)->delete(); |
37 | 37 | } |
38 | 38 | } catch (\Throwable $e) { |
39 | - Log::emergency('Error deleting all data from the page internal id: ' . $pageModel->id); |
|
39 | + Log::emergency('Error deleting all data from the page internal id: '.$pageModel->id); |
|
40 | 40 | throw $e; |
41 | 41 | } |
42 | 42 | }); |
@@ -12,31 +12,31 @@ |
||
12 | 12 | { |
13 | 13 | public function user(string $provider): SocialiteUser |
14 | 14 | { |
15 | - if($provider === 'twitter'){ |
|
15 | + if ($provider === 'twitter') { |
|
16 | 16 | $user = Socialite::driver($provider)->user(); |
17 | - }elseif($provider === 'facebook'){ |
|
17 | + }elseif ($provider === 'facebook') { |
|
18 | 18 | $user = Socialite::driver($provider)->fields(['name', 'first_name', 'last_name', 'email'])->user(); |
19 | - }else { |
|
19 | + } else { |
|
20 | 20 | $user = Socialite::driver($provider)->stateless()->user(); |
21 | 21 | } |
22 | 22 | |
23 | 23 | $email = $user->getEmail(); |
24 | 24 | |
25 | 25 | // For twitter, we prefer to use the name. If empty we'll use the twitter account (nickname): |
26 | - $firstname = $user->getName() !== null ? $user->getName() : $user->getNickname(); |
|
27 | - if(!empty($user->user['given_name'])){ |
|
26 | + $firstname = $user->getName() !== null ? $user->getName() : $user->getNickname(); |
|
27 | + if (!empty($user->user['given_name'])) { |
|
28 | 28 | |
29 | 29 | $firstname = $user->user['given_name']; |
30 | - }elseif (!empty($user->user['first_name'])){ |
|
30 | + }elseif (!empty($user->user['first_name'])) { |
|
31 | 31 | |
32 | 32 | $firstname = $user->user['first_name']; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $lastname = $user->getName(); |
36 | - if(!empty($user->user['family_name'])){ |
|
36 | + if (!empty($user->user['family_name'])) { |
|
37 | 37 | |
38 | 38 | $lastname = $user->user['family_name']; |
39 | - }elseif (!empty($user->user['last_name'])){ |
|
39 | + }elseif (!empty($user->user['last_name'])) { |
|
40 | 40 | |
41 | 41 | $lastname = $user->user['last_name']; |
42 | 42 | } |