| @@ 34-44 (lines=11) @@ | ||
| 31 | * @param mixed $data |
|
| 32 | * @return object |
|
| 33 | */ |
|
| 34 | public function create($data) |
|
| 35 | { |
|
| 36 | if (array_get($data, 'is_home') === '1') { |
|
| 37 | $this->removeOtherHomepage(); |
|
| 38 | } |
|
| 39 | $page = $this->model->create($data); |
|
| 40 | ||
| 41 | event(new PageWasCreated($page->id, $data)); |
|
| 42 | ||
| 43 | return $page; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @param $model |
|
| @@ 51-61 (lines=11) @@ | ||
| 48 | * @param array $data |
|
| 49 | * @return object |
|
| 50 | */ |
|
| 51 | public function update($model, $data) |
|
| 52 | { |
|
| 53 | if (array_get($data, 'is_home') === '1') { |
|
| 54 | $this->removeOtherHomepage(); |
|
| 55 | } |
|
| 56 | $model->update($data); |
|
| 57 | ||
| 58 | event(new PageWasUpdated($model->id, $data)); |
|
| 59 | ||
| 60 | return $model; |
|
| 61 | } |
|
| 62 | ||
| 63 | public function destroy($model) |
|
| 64 | { |
|