@@ -40,7 +40,7 @@ |
||
40 | 40 | $this->department = $departmentNumber; |
41 | 41 | $this->fullname = $this->fullname(); |
42 | 42 | $characteristicsByType = []; |
43 | - foreach($characteristics as $characteristic){ |
|
43 | + foreach ($characteristics as $characteristic) { |
|
44 | 44 | $characteristicsByType[$characteristic->type()][] = $characteristic; |
45 | 45 | } |
46 | 46 |
@@ -26,12 +26,12 @@ |
||
26 | 26 | |
27 | 27 | public function toDto():ContextDto |
28 | 28 | { |
29 | - $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item){ |
|
29 | + $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item) { |
|
30 | 30 | return $item->toDto(); |
31 | 31 | }); |
32 | 32 | $characteristicDepartment = CharacteristicsModel::query()->where('code', $this->department_number)->first(); |
33 | 33 | |
34 | - if(isset($characteristicDepartment)){ |
|
34 | + if (isset($characteristicDepartment)) { |
|
35 | 35 | $characteristics->push($characteristicDepartment->toDto()); |
36 | 36 | } |
37 | 37 |
@@ -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(); |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | ->selectRaw('count(*) AS count, contexts.department_number as department_number') |
16 | 16 | ->join('users', 'users.id', 'interactions.user_id') |
17 | 17 | ->join('contexts', 'users.context_id', 'contexts.id') |
18 | - ->where(function ($query) use ($type){ |
|
19 | - $query->when($type === 'follow', function ($query) { |
|
18 | + ->where(function($query) use ($type){ |
|
19 | + $query->when($type === 'follow', function($query) { |
|
20 | 20 | $query->where('follow', true); |
21 | 21 | $query->orWhere('done', true); |
22 | 22 | }) |
23 | - ->when($type === 'do', function ($query) { |
|
23 | + ->when($type === 'do', function($query) { |
|
24 | 24 | $query->where('done', true); |
25 | 25 | }); |
26 | 26 | }) |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ->get(); |
31 | 31 | |
32 | 32 | $interactionsToReturn = []; |
33 | - foreach($interactions as $interaction){ |
|
33 | + foreach ($interactions as $interaction) { |
|
34 | 34 | $characteristicsModel = CharacteristicsModel::query()->where('code', $interaction->department_number)->first(); |
35 | 35 | $characteristicsModel->icon = route('api.icon.serve', ['id' => $characteristicsModel->uuid]); |
36 | 36 | $interaction->departmentData = $characteristicsModel; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | ->join('contexts', 'users.context_id', 'contexts.id') |
51 | 51 | ->join('user_characteristics', 'user_characteristics.user_id', 'users.id') |
52 | 52 | ->join('characteristics', 'characteristics.id', 'user_characteristics.characteristic_id') |
53 | - ->where(function ($query) use ($type){ |
|
54 | - $query->when($type === 'follow', function ($query) { |
|
53 | + ->where(function($query) use ($type){ |
|
54 | + $query->when($type === 'follow', function($query) { |
|
55 | 55 | $query->where('follow', true); |
56 | 56 | $query->orWhere('done', true); |
57 | 57 | }) |
58 | - ->when($type === 'do', function ($query) { |
|
58 | + ->when($type === 'do', function($query) { |
|
59 | 59 | $query->where('done', true); |
60 | 60 | }); |
61 | 61 | }) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ->get(); |
69 | 69 | |
70 | 70 | $characteristicsToReturn = []; |
71 | - foreach($characteristicsCount as $characteristicCount){ |
|
71 | + foreach ($characteristicsCount as $characteristicCount) { |
|
72 | 72 | $characteristic = CharacteristicsModel::query()->find($characteristicCount->characteristic_id); |
73 | 73 | $characteristic->count = $characteristicCount->count; |
74 | 74 | $c = $characteristic->toArray(); |
@@ -11,6 +11,6 @@ |
||
11 | 11 | public function getByType(string $type, bool $isMain):array; |
12 | 12 | public function getAllByType(string $type):array; |
13 | 13 | public function save(Characteristic $c); |
14 | - public function getBy(array $conditions):?Characteristic; |
|
15 | - public function getByPageId(int $pageId):?Characteristic; |
|
14 | + public function getBy(array $conditions): ?Characteristic; |
|
15 | + public function getByPageId(int $pageId): ?Characteristic; |
|
16 | 16 | } |