コード例 #1
0
 public function __construct()
 {
     // Set up some standard body classes for easy CSS targeting
     $calledClass = strtolower(get_called_class());
     $namespaces = str_ireplace('App\\Http\\Controllers\\', '', $calledClass);
     $namespaces = explode('\\', $namespaces);
     array_pop($namespaces);
     $this->bodyClasses += $namespaces;
     $this->bodyClasses[] = str_ireplace('controller', '', class_basename($calledClass));
     $action = \Route::currentRouteAction();
     $action = substr($action, strpos($action, "@") + 1);
     $this->bodyClasses[] = \App\Helpers\Text::camelToDashes(str_ireplace(['get', 'post', 'put', 'delete'], '', $action));
     \View::share('bodyClass', implode(' ', $this->bodyClasses));
     // The timezone that should be used when displaying information
     $this->timezone = 'America/Denver';
     \View::share('timezone', $this->timezone);
 }