@@ -25,11 +25,10 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return self |
27 | 27 | */ |
28 | - public function with(array|string $relation): self |
|
28 | + public function with(array | string $relation): self |
|
29 | 29 | { |
30 | 30 | $this->withs = is_string($relation) ? |
31 | - [...$this->withs, $relation] : |
|
32 | - [...$this->withs, ...$relation]; |
|
31 | + [...$this->withs, $relation] : [...$this->withs, ...$relation]; |
|
33 | 32 | return $this; |
34 | 33 | } |
35 | 34 | |
@@ -38,11 +37,10 @@ discard block |
||
38 | 37 | * |
39 | 38 | * @return self |
40 | 39 | */ |
41 | - public function withCount(array|string $relation): self |
|
40 | + public function withCount(array | string $relation): self |
|
42 | 41 | { |
43 | 42 | $this->withCounts = is_string($relation) ? |
44 | - [...$this->withCounts, $relation] : |
|
45 | - [...$this->withCounts, ...$relation]; |
|
43 | + [...$this->withCounts, $relation] : [...$this->withCounts, ...$relation]; |
|
46 | 44 | return $this; |
47 | 45 | } |
48 | 46 | |
@@ -51,7 +49,7 @@ discard block |
||
51 | 49 | * |
52 | 50 | * @return void |
53 | 51 | */ |
54 | - protected function addWith(Builder|Relation $query) |
|
52 | + protected function addWith(Builder | Relation $query) |
|
55 | 53 | { |
56 | 54 | $query->when(count($this->withs) > 0, fn() => $query->with($this->withs)) |
57 | 55 | ->when(count($this->withCounts) > 0, fn() => $query->withCount($this->withCounts)); |
@@ -66,8 +66,7 @@ |
||
66 | 66 | public function togglePresence(Session $session, Member $member) |
67 | 67 | { |
68 | 68 | !$session->absents()->find($member->id) ? |
69 | - $session->absents()->attach($member->id) : |
|
70 | - $session->absents()->detach($member->id); |
|
69 | + $session->absents()->attach($member->id) : $session->absents()->detach($member->id); |
|
71 | 70 | } |
72 | 71 | |
73 | 72 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | protected function getSession() |
38 | 38 | { |
39 | - if($this->target()->method() === 'home' || |
|
39 | + if ($this->target()->method() === 'home' || |
|
40 | 40 | ($sessionId = $this->bag('presence')->get('session.id')) === 0) |
41 | 41 | { |
42 | 42 | return; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $this->jq('.btn-show-member-presences') |
112 | 112 | ->click($this->cl(Presence::class)->rq()->selectMember($memberId)); |
113 | 113 | |
114 | - if($this->fromHome && $members->count() > 0) |
|
114 | + if ($this->fromHome && $members->count() > 0) |
|
115 | 115 | { |
116 | 116 | $member = $members->first(); |
117 | 117 | $this->cl(Session::class)->show($member); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function togglePresence(int $memberId) |
141 | 141 | { |
142 | 142 | $member = $this->memberService->getMember($memberId); |
143 | - if(!$member) |
|
143 | + if (!$member) |
|
144 | 144 | { |
145 | 145 | return $this->response; |
146 | 146 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | protected function getMember() |
38 | 38 | { |
39 | - if($this->target()->method() === 'home' || |
|
39 | + if ($this->target()->method() === 'home' || |
|
40 | 40 | ($memberId = $this->bag('presence')->get('member.id')) === 0) |
41 | 41 | { |
42 | 42 | return; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $this->jq('.btn-show-session-presences') |
104 | 104 | ->click($this->cl(Presence::class)->rq()->selectSession($sessionId)); |
105 | 105 | |
106 | - if($this->fromHome && $sessions->count() > 0) |
|
106 | + if ($this->fromHome && $sessions->count() > 0) |
|
107 | 107 | { |
108 | 108 | $session = $sessions->first(); |
109 | 109 | $this->cl(Member::class)->show($session); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function togglePresence(int $sessionId) |
116 | 116 | { |
117 | 117 | $session = $this->sessionService->getSession($sessionId); |
118 | - if(!$session) |
|
118 | + if (!$session) |
|
119 | 119 | { |
120 | 120 | return $this->response; |
121 | 121 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function selectSession(int $sessionId) |
53 | 53 | { |
54 | - if(!($session = $this->presenceService->getSession($sessionId))) |
|
54 | + if (!($session = $this->presenceService->getSession($sessionId))) |
|
55 | 55 | { |
56 | 56 | // Todo: show en error message |
57 | 57 | return $this->response; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function selectMember(int $memberId) |
67 | 67 | { |
68 | - if(!($member = $this->presenceService->getMember($memberId))) |
|
68 | + if (!($member = $this->presenceService->getMember($memberId))) |
|
69 | 69 | { |
70 | 70 | // Todo: show en error message |
71 | 71 | return $this->response; |