public function select($label = 'Categoria', $groupSlug = '', $model = '') { if ($groupSlug == '') { dd('groupSlug indefinido'); } $categories = Category::where('group_slug', $groupSlug)->get()->lists('name', 'id'); $currentCategory = $model != '' ? $model->category_id : null; $currentCategory = Input::get('category_id') ?: null; $html = Form::control('select', 'category_id', $label, $currentCategory, [], $categories); return $html; }
/** * Define your module's route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { parent::boot($router); $router->bind('categories', function ($id) { $category = Category::find($id); if (!$category) { abort(404); } return $category; }); }