public function __construct() { parent::__construct(); if (Input::get('category')) { $this->category = ProductCategory::find((int) Input::get('category')); } $title = 'Produtos' . ($this->category ? ': ' . $this->category->name : ''); View::share('pageTitle', $title); Breadcrumbs::addCrumb($title, route("admin.product.index")); }
public function __construct() { parent::__construct(); foreach (['resourceTitle', 'resourceName', 'modelClass', 'moduleName'] as $required) { if (empty($this->{$required})) { throw new Exception("'{$required}' is an required attribute of resource controller"); } } $class = get_class($this); $auxClass = explode('\\', $class); if (!$this->moduleName) { $this->moduleName = strtolower($auxClass[1]); } if (!$this->controllerRealName) { $this->controllerRealName = $auxClass[count($auxClass) - 1]; $this->controllerRealName = str_replace('Controller', '', $this->controllerRealName); $this->controllerName = strtolower($this->controllerRealName); for ($i = count($auxClass) - 2; $i > 1; $i--) { $v = $auxClass[$i]; if (stristr($v, 'controller')) { break; } $this->controllerNamespace[] = strtolower($v); } } if ($this->parentResourceName) { $this->routePrefix = "admin.{$this->parentResourceName}.{$this->resourceName}"; } else { $this->routePrefix = "admin.{$this->resourceName}"; } View::share('pageTitle', str_plural($this->resourceTitle)); View::share('resourceTitle', $this->resourceTitle); View::share('resourceName', $this->resourceName); View::share('routePrefix', $this->routePrefix); View::share('moduleName', $this->moduleName); View::share('controllerName', $this->controllerName); View::share('controllerRealName', $this->controllerRealName); View::share('tableColumns', $this->getColumns()); View::share('orderable', $this->orderable); Breadcrumbs::addCrumb(str_plural($this->resourceTitle), URL::route($this->routePrefix . ".index", $this->getDefaultRouteParameters())); }