/** * View all the existing categories (tabulated). * @return mixed */ public function index() { $categories = ResourceCategory::orderBy('name', 'ASC')->paginate(20); return View::make('resources.categories.list')->with('categories', $categories); }
/** * Attach the resource categories, tags and misc * variables to the necessary views. */ private function attachResourceFields() { View::composer('resources._form', function ($view) { $view->with(['categories' => ResourceCategory::orderBy('name', 'ASC')->lists('name', 'id'), 'tags' => ResourceTag::orderBy('name', 'ASC')->lists('name', 'id'), 'access' => Resource::getAccessList()]); }); View::composer(['resources.index', 'resources.list', 'resources.partials.search_inputs'], function ($view) { $categories = ResourceCategory::orderBy('name', 'ASC')->get(); $tags = ResourceTag::orderBy('name', 'ASC')->get(); $view->with(['all_categories' => $categories, 'all_tags' => $tags]); }); }