Edit File: CategoryController.php
<?php namespace App\Http\Controllers\Admin; use App\Models\Category; use App\Services\Entity\CategoryService; use Illuminate\Http\JsonResponse; use Illuminate\View\View; class CategoryController extends BaseController { public function __construct(CategoryService $service) { parent::__construct($service); view()->share('categories', Category::head()->latest()->get()); } /** * Display a listing of the resource. * @param int|null $id The category id. * @return JsonResponse|mixed|View */ public function index($id = null) { return $this->service->index($id); } /** * Create a new category. * @return View */ public function create($id = null): View { return $this->service->create($id); } }
Back to File Manager