Example #1
0
 /**
  * Initializer.
  *
  * @access   public
  * @return BaseController
  */
 public function __construct()
 {
     $is_admin = Request::is('admin*');
     $is_backend = Request::is('backend*');
     /* Set middleware(s) based on route URLs */
     if ($is_admin || $is_backend) {
         $this->middleware('auth');
         if ($is_backend) {
             // Backend specific middleware
             $this->middleware('auth.backend');
         }
         $this->middleware('auth.permissions');
         if (!Request::is('*users/change-password')) {
             // No validation for stale password if password is being changed
             $this->middleware('auth.pw_6_months');
         }
     }
     list($this->link_type, $this->link, $this->layout, $this->current_theme) = current_section();
     View::share('link_type', $this->link_type);
     View::share('current_theme', $this->current_theme);
     $website_settings = Setting::lists('value', 'name')->all();
     View::share('website_settings', $website_settings);
     $locale = Setting::value('language');
     App::setLocale($locale);
     Lang::setLocale($locale);
     $this->user = current_user();
     View::share('current_user', $this->user);
     View::share('current_user_companies', current_user_companies());
 }
Example #2
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $exception)
 {
     if ($exception && method_exists($exception, 'getStatusCode')) {
         $code = $exception->getStatusCode();
     } else {
         $code = 500;
     }
     if (App::environment() != 'local') {
         list($link_type, $link, $layout, $theme) = current_section();
         View::share('current_theme', $theme);
         $current_user = current_user();
         if ($exception instanceof Illuminate\Database\Eloquent\ModelNotFoundException) {
             return response(view("{$link_type}.{$theme}.404", array('title' => 'Page Not Found', 'current_user' => $current_user), array(404)));
         }
         switch ($code) {
             case 401:
                 return response(view("{$link_type}.{$theme}.401", array('title' => 'Unauthorized access', 'current_user' => $current_user), array(401)));
                 break;
             case 404:
                 return response(view("{$link_type}.{$theme}.404", array('title' => 'Page Not Found', 'current_user' => $current_user), array(404)));
                 break;
             case 503:
                 return response(view('503', array('title' => 'Site Offline', 'link_type' => $link_type, 'current_user' => $current_user), array(503)));
                 break;
             default:
                 return response(view("{$link_type}.{$theme}.500", array('title' => 'Error', 'current_user' => $current_user), array($code)));
                 break;
         }
     }
     return parent::render($request, $exception);
 }
Example #3
0
 /**
  * Initializer.
  *
  * @access   public
  * @return BaseController
  */
 public function __construct()
 {
     list($this->link_type, $this->link, $this->layout, $this->current_theme) = current_section();
     View::share('link_type', $this->link_type);
     View::share('current_theme', $this->current_theme);
     $website_settings = Setting::lists('value', 'name');
     View::share('website_settings', $website_settings);
     $this->user = current_user();
     View::share('current_user', $this->user);
 }
Example #4
0
 /**
  * Initializer.
  *
  * @access   public
  * @return BaseController
  */
 public function __construct()
 {
     list($this->link_type, $this->link, $this->layout, $this->current_theme) = current_section();
     View::share('link_type', $this->link_type);
     View::share('current_theme', $this->current_theme);
     $website_settings = Setting::lists('value', 'name');
     View::share('website_settings', $website_settings);
     $locale = Setting::value('language');
     App::setLocale($locale);
     Lang::setLocale($locale);
     $this->user = current_user();
     View::share('current_user', $this->user);
     View::share('current_user_companies', current_user_companies());
 }
Example #5
0
 public function __construct()
 {
     list($this->link_type, $this->current_theme) = current_section();
 }
Example #6
0
 /**
  * Get the link associated with the menu
  */
 public function link()
 {
     if ($this->link == 'manual') {
         if ($this->is_wrapper) {
             // dd('wrapper/' . $this->id);
             return 'wrapper/' . $this->id;
         } else {
             return $this->link_manual;
         }
     } else {
         list($link_type, $link, $layout) = current_section();
         $this->link = str_replace('link_type/', $link, $this->link);
         return $this->link;
     }
 }
Example #7
0
 /**
  * Get the link associated with the menu
  */
 public function link()
 {
     if ($this->link == 'manual') {
         return $this->link_manual;
     } else {
         list($link_type, $link, $layout) = current_section();
         $this->link = str_replace('link_type/', $link, $this->link);
         return $this->link;
     }
 }
Example #8
0
 /**
  * Get current template path
  * @return string
  */
 function get_template_directory()
 {
     list($type, $theme) = current_section();
     return asset('templates/' . $type . '/' . $theme);
 }