@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface PageRepository |
| 10 | 10 | { |
| 11 | - public function get(string $pageId):?Page; |
|
| 11 | + public function get(string $pageId): ?Page; |
|
| 12 | 12 | public function getByIds(array $pagesId):array; |
| 13 | 13 | public function save(Page $page); |
| 14 | 14 | } |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | return $list->toArray(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function getByPageId(string $pageId):?Characteristic |
|
| 35 | + public function getByPageId(string $pageId): ?Characteristic |
|
| 36 | 36 | { |
| 37 | 37 | $c = CharacteristicsModel::query() |
| 38 | 38 | ->where('page_id', $pageId) |
| 39 | 39 | ->first(); |
| 40 | - if(!isset($c)){ |
|
| 40 | + if (!isset($c)) { |
|
| 41 | 41 | return null; |
| 42 | 42 | } |
| 43 | 43 | return $c->toDomain(); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function add(array $cs) |
| 52 | 52 | { |
| 53 | - foreach ($cs as $c){ |
|
| 53 | + foreach ($cs as $c) { |
|
| 54 | 54 | $cModel = new CharacteristicsModel(); |
| 55 | 55 | $cModel->fill($c); |
| 56 | 56 | $cModel->save(); |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | public function getBy(array $conditions): ?Characteristic |
| 76 | 76 | { |
| 77 | 77 | $characteristicModel = CharacteristicsModel::query() |
| 78 | - ->when(isset($conditions['type']), function ($query) use($conditions){ |
|
| 78 | + ->when(isset($conditions['type']), function($query) use($conditions){ |
|
| 79 | 79 | $query->where('type', $conditions['type']); |
| 80 | 80 | }) |
| 81 | - ->when(isset($conditions['title']), function ($query) use($conditions){ |
|
| 81 | + ->when(isset($conditions['title']), function($query) use($conditions){ |
|
| 82 | 82 | $query->where('code', $conditions['title']); |
| 83 | 83 | }) |
| 84 | 84 | ->first(); |
| 85 | - if(!isset($characteristicModel)){ |
|
| 85 | + if (!isset($characteristicModel)) { |
|
| 86 | 86 | return null; |
| 87 | 87 | } |
| 88 | 88 | return $characteristicModel->toDomain(); |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $characteristicModel = CharacteristicsModel::query() |
| 94 | 94 | ->where('type', $type) |
| 95 | - ->where('pretty_page_label','LIKE', '%'.$search.'%') |
|
| 95 | + ->where('pretty_page_label', 'LIKE', '%'.$search.'%') |
|
| 96 | 96 | ->get(); |
| 97 | 97 | |
| 98 | - if(!isset($characteristicModel)){ |
|
| 98 | + if (!isset($characteristicModel)) { |
|
| 99 | 99 | return []; |
| 100 | 100 | } |
| 101 | - foreach ($characteristicModel as $characteristic){ |
|
| 101 | + foreach ($characteristicModel as $characteristic) { |
|
| 102 | 102 | $characteristics[] = $characteristic->toArray(); |
| 103 | 103 | } |
| 104 | 104 | return $characteristics ?? []; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | public function get(string $pageId): ?Page |
| 15 | 15 | { |
| 16 | 16 | $pageModel = PageModel::where('page_id', $pageId)->first(); |
| 17 | - if(!isset($pageModel)){ |
|
| 17 | + if (!isset($pageModel)) { |
|
| 18 | 18 | return null; |
| 19 | 19 | } |
| 20 | 20 | return new Page($pageModel->page_id, $pageModel->dry); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function save(Page $page) |
| 35 | 35 | { |
| 36 | 36 | $pageModel = PageModel::where('page_id', $page->pageId())->first(); |
| 37 | - if(!isset($pageModel)){ |
|
| 37 | + if (!isset($pageModel)) { |
|
| 38 | 38 | $pageModel = new PageModel(); |
| 39 | 39 | } |
| 40 | 40 | $pageModel->page_id = $page->pageId(); |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | public function search(string $type, string $search):array |
| 46 | 46 | { |
| 47 | 47 | $pageModel = PageModel::query() |
| 48 | - ->where('title','LIKE', '%'.$search.'%') |
|
| 48 | + ->where('title', 'LIKE', '%'.$search.'%') |
|
| 49 | 49 | ->where('type', $type) |
| 50 | 50 | ->get(); |
| 51 | 51 | |
| 52 | - if(!isset($pageModel)){ |
|
| 52 | + if (!isset($pageModel)) { |
|
| 53 | 53 | return []; |
| 54 | 54 | } |
| 55 | 55 | return $pageModel->toArray(); |