/** * Translates and return a title for a menu item. * * This method will attempt to find a "menu.key_item" through the translator * component. If no translation is found for this item, it will attempt to * transform the item $key string to a title readable format. * * @param $key * @return string */ protected function translateTitle($key) { $translation = $this->lang->get('menu.' . $key); if ($translation != 'menu.' . $key) { return $translation; } return String::title($key); }
/** * Attempt to get the option list from the model * * The model needs to be set and have a method with the following convention: * * attribute -> get[Attribute]Options, i.e.: * user_id -> getUserIdOptions() * * Otherwise it will return an empty array * * @param $name * * @return mixed */ protected function getOptionsFromModel($name) { $model = $this->form->getModel(); if (is_null($model)) { return array(); } $method = 'get' . String::studly($name) . 'Options'; if (method_exists($model, $method)) { return $model->{$method}(); } return array(); }