@@ 5-27 (lines=23) @@ | ||
2 | ||
3 | namespace App\ViewModels; |
|
4 | ||
5 | class CategoryDetailViewModel extends FormViewModel |
|
6 | { |
|
7 | protected function setTitle() |
|
8 | { |
|
9 | $this->title = $this->model->exists |
|
10 | ? "Edit Category: {$this->model->name}" |
|
11 | : 'Create Category'; |
|
12 | } |
|
13 | ||
14 | protected function setAction() |
|
15 | { |
|
16 | $this->action = $this->model->exists |
|
17 | ? route('backend.categories.update', $this->model) |
|
18 | : route('backend.categories.store'); |
|
19 | } |
|
20 | ||
21 | protected function setMethod() |
|
22 | { |
|
23 | $this->method = $this->model->exists |
|
24 | ? 'PUT' |
|
25 | : 'POST'; |
|
26 | } |
|
27 | } |
|
28 |
@@ 5-27 (lines=23) @@ | ||
2 | ||
3 | namespace App\ViewModels; |
|
4 | ||
5 | class ThemeDetailViewModel extends FormViewModel |
|
6 | { |
|
7 | protected function setTitle() |
|
8 | { |
|
9 | $this->title = $this->model->exists |
|
10 | ? "Edit Theme: {$this->model->name}" |
|
11 | : 'Create Theme'; |
|
12 | } |
|
13 | ||
14 | protected function setAction() |
|
15 | { |
|
16 | $this->action = $this->model->exists |
|
17 | ? route('backend.themes.update', $this->model) |
|
18 | : route('backend.themes.store'); |
|
19 | } |
|
20 | ||
21 | protected function setMethod() |
|
22 | { |
|
23 | $this->method = $this->model->exists |
|
24 | ? 'PUT' |
|
25 | : 'POST'; |
|
26 | } |
|
27 | } |
|
28 |