| @@ 7-26 (lines=20) @@ | ||
| 4 | ||
| 5 | use Illuminate\Http\Resources\Json\Resource; |
|
| 6 | ||
| 7 | class CategoryResource extends Resource |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Transform the resource into an array. |
|
| 11 | * |
|
| 12 | * @param \Illuminate\Http\Request |
|
| 13 | * @return array |
|
| 14 | */ |
|
| 15 | public function toArray($request) |
|
| 16 | { |
|
| 17 | return [ |
|
| 18 | 'id' => $this->id, |
|
| 19 | 'url_edit' => route('backend.categories.edit', $this), |
|
| 20 | 'url_delete' => route('backend.categories.destroy', $this), |
|
| 21 | 'name' => $this->name, |
|
| 22 | 'created_at' => $this->created_at->format('Y-m-d H:i'), |
|
| 23 | 'active' => $this->active, |
|
| 24 | ]; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 7-26 (lines=20) @@ | ||
| 4 | ||
| 5 | use Illuminate\Http\Resources\Json\Resource; |
|
| 6 | ||
| 7 | class ThemeResource extends Resource |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Transform the resource into an array. |
|
| 11 | * |
|
| 12 | * @param \Illuminate\Http\Request |
|
| 13 | * @return array |
|
| 14 | */ |
|
| 15 | public function toArray($request) |
|
| 16 | { |
|
| 17 | return [ |
|
| 18 | 'id' => $this->id, |
|
| 19 | 'url_edit' => route('backend.themes.edit', $this), |
|
| 20 | 'url_delete' => route('backend.themes.destroy', $this), |
|
| 21 | 'name' => $this->name, |
|
| 22 | 'selected' => $this->selected, |
|
| 23 | 'created_at' => $this->created_at->format('Y-m-d H:i'), |
|
| 24 | ]; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||