| @@ 26-33 (lines=8) @@ | ||
| 23 | * |
|
| 24 | * @return bool |
|
| 25 | */ |
|
| 26 | public static function create(array $data): bool |
|
| 27 | { |
|
| 28 | $category = new Category; |
|
| 29 | $category->title = $data['title']; |
|
| 30 | $category->description = $data['description']; |
|
| 31 | ||
| 32 | return $category->save(); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Update the category data and save it. |
|
| @@ 43-49 (lines=7) @@ | ||
| 40 | * |
|
| 41 | * @return bool |
|
| 42 | */ |
|
| 43 | public static function update(array $data, Category $category): bool |
|
| 44 | { |
|
| 45 | $category->title = $data['title']; |
|
| 46 | $category->description = $data['description']; |
|
| 47 | ||
| 48 | return $category->save(); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||