@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | ->where('page_id', $interaction->pageId()) |
| 27 | 27 | ->first(); |
| 28 | 28 | |
| 29 | - if($interactionModel === null) { |
|
| 29 | + if ($interactionModel === null) { |
|
| 30 | 30 | $interactionModel = new InteractionModel(); |
| 31 | 31 | $interactionModel->{$canInteract->key()} = isset($user->id) ? $user->id : $canInteract->identifier(); |
| 32 | 32 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function getByInteractUser(CanInteract $canInteract, int $pageId): ?Interaction |
| 40 | 40 | { |
| 41 | - if($canInteract->key() == 'user_id') { |
|
| 41 | + if ($canInteract->key() == 'user_id') { |
|
| 42 | 42 | $user = User::query()->where('uuid', $canInteract->identifier())->first(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | ->where('page_id', $pageId) |
| 48 | 48 | ->first(); |
| 49 | 49 | |
| 50 | - if(!isset($interactionModel)){ |
|
| 50 | + if (!isset($interactionModel)) { |
|
| 51 | 51 | return null; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | ->orderBy('updated_at', 'desc') |
| 84 | 84 | ->get(); |
| 85 | 85 | |
| 86 | - foreach($interactionsModel as $interaction) { |
|
| 86 | + foreach ($interactionsModel as $interaction) { |
|
| 87 | 87 | $page = PageModel::query()->where('page_id', $interaction->page_id)->first(); |
| 88 | 88 | $applause = InteractionModel::query()->where('page_id', $interaction->page_id)->where('applause', true)->count(); |
| 89 | 89 | if ($interaction->follow) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ->where('user_id', $user->id) |
| 106 | 106 | ->where('done', true) |
| 107 | 107 | ->get(); |
| 108 | - foreach ($records as $record){ |
|
| 108 | + foreach ($records as $record) { |
|
| 109 | 109 | $practises[] = new PractiseVo( |
| 110 | 110 | $record->page_id, |
| 111 | 111 | $record->page->title ?? '', |
@@ -130,15 +130,15 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | return InteractionModel::query() |
| 132 | 132 | ->with('user.context') |
| 133 | - ->when($type == 'follow', function ($query) { |
|
| 133 | + ->when($type == 'follow', function($query) { |
|
| 134 | 134 | $query->where('follow', true); |
| 135 | 135 | }) |
| 136 | - ->when($type == 'do', function ($query) { |
|
| 136 | + ->when($type == 'do', function($query) { |
|
| 137 | 137 | $query->where('done', true); |
| 138 | 138 | }) |
| 139 | - ->when($characteristicId !== null, function ($query) use($characteristicId) { |
|
| 139 | + ->when($characteristicId !== null, function($query) use($characteristicId) { |
|
| 140 | 140 | $characteristic = CharacteristicsModel::query()->where('uuid', $characteristicId)->first(); |
| 141 | - if(!isset($characteristic)){ |
|
| 141 | + if (!isset($characteristic)) { |
|
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | $query->whereRaw( |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | $characteristic->id |
| 147 | 147 | ); |
| 148 | 148 | }) |
| 149 | - ->when($characteristicIdCroppingSystem !== null, function ($query) use($characteristicIdCroppingSystem) { |
|
| 149 | + ->when($characteristicIdCroppingSystem !== null, function($query) use($characteristicIdCroppingSystem) { |
|
| 150 | 150 | $characteristic = CharacteristicsModel::query()->where('uuid', $characteristicIdCroppingSystem)->first(); |
| 151 | - if(!isset($characteristic)){ |
|
| 151 | + if (!isset($characteristic)) { |
|
| 152 | 152 | return; |
| 153 | 153 | } |
| 154 | 154 | $query->whereRaw( |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $characteristic->id |
| 157 | 157 | ); |
| 158 | 158 | }) |
| 159 | - ->when($departmentNumber !== null, function ($query) use($departmentNumber) { |
|
| 159 | + ->when($departmentNumber !== null, function($query) use($departmentNumber) { |
|
| 160 | 160 | $query |
| 161 | 161 | ->join('users', 'users.id', 'interactions.user_id') |
| 162 | 162 | ->join('contexts', 'users.context_id', 'contexts.id') |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ->where('page_id', $pageId) |
| 166 | 166 | ->whereNotNull('interactions.user_id') |
| 167 | 167 | ->paginate() |
| 168 | - ->through(function ($item){ |
|
| 168 | + ->through(function($item) { |
|
| 169 | 169 | return $item->user->context->toDto($item->user->uuid, $item->start_done_at ? $item->start_done_at->format('Y-m-d') : $item->done); |
| 170 | 170 | }) |
| 171 | 171 | ; |
@@ -23,14 +23,14 @@ |
||
| 23 | 23 | |
| 24 | 24 | public function toDto(?string $userUid = null, $hasDone = false):ContextDto |
| 25 | 25 | { |
| 26 | - $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item){ |
|
| 26 | + $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item) { |
|
| 27 | 27 | return $item->toDto(); |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | 30 | $numberDepartment = (new PostalCode($this->postal_code))->department(); |
| 31 | 31 | $characteristicDepartment = CharacteristicsModel::query()->where('code', $numberDepartment)->first(); |
| 32 | 32 | |
| 33 | - if(isset($characteristicDepartment)){ |
|
| 33 | + if (isset($characteristicDepartment)) { |
|
| 34 | 34 | $characteristics->push($characteristicDepartment->toDto()); |
| 35 | 35 | } |
| 36 | 36 | |