public function __construct() { $this->middleware('auth', ['except' => ['getIndex', 'getIndexByCategory', 'getResource']]); $this->categories = Category::all(); }