示例#1
0
 public static function errors($code = 404, $title = '', $message = '')
 {
     $ajax = Request::ajax();
     if (!$code) {
         $code = 500;
         $title = 'Internal Server Error';
         $message = 'We got problems over here. Please try again later!';
     } else {
         if ($code == 404) {
             $title = 'Oops! You\'re lost.';
             $message = 'We can not find the page you\'re looking for.';
         }
     }
     if (Request::ajax()) {
         return Response::json(['error' => ['message' => $message]], $code);
     }
     $arrData = [];
     $arrData['content'] = View::make('frontend.errors.error')->with(['title' => $title, 'code' => $code, 'message' => $message]);
     $arrData['metaInfo'] = Home::getMetaInfo();
     $arrData['metaInfo']['meta_title'] = $title;
     $arrData['types'] = Home::getTypes();
     $arrData['categories'] = Home::getCategories();
     $arrData['headerMenu'] = Menu::getCache(['header' => true]);
     return View::make('frontend.layout.default')->with($arrData);
 }