public function beforeRenderForm($view, $model) { $selectOtherCategories = [0 => 'Nenhuma']; if ($model->id) { $categories = ProductCategory::where('id', '!=', $model->id)->get(); } else { $categories = ProductCategory::get(); } foreach ($categories as $category) { $selectOtherCategories[$category->id] = $category->fullName; } $view->with('selectOtherCategories', $selectOtherCategories); return $view; }
public function __construct() { parent::__construct(); if (Input::get('category')) { $this->category = ProductCategory::where('slug', '=', Input::get('category'))->first(); } if ($this->category) { $title = $this->category->name; } else { $title = 'Produtos'; } View::share('pageTitle', $title); if ($this->category) { Breadcrumbs::addCrumb('Produtos', route("product.index")); } Breadcrumbs::addCrumb($title, route("product.index", ['category' => Input::get('category')])); }