当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::view方法代码示例

本文整理汇总了PHP中Response::view方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::view方法的具体用法?PHP Response::view怎么用?PHP Response::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Response的用法示例。


在下文中一共展示了Response::view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showUser

 public function showUser($screen_name)
 {
     if (User::where('screen_name', '=', $screen_name)->first() == NULL) {
         return Response::view('404', array('title' => '404 page'), 404);
     }
     $category_names = array('ent' => 'エンターテイメント', 'music' => '音楽', 'sing' => '歌ってみた', 'play' => '演奏してみた', 'dance' => '踊ってみた', 'vocaloid' => 'VOCALOID', 'nicoindies' => 'ニコニコインディーズ', 'animal' => '動物', 'cooking' => '料理', 'nature' => '自然', 'travel' => '旅行', 'sport' => 'スポーツ', 'lecture' => 'ニコニコ動画講座', 'drive' => '車載動画', 'history' => '歴史', 'politics' => '政治', 'science' => '科学', 'tech' => 'ニコニコ技術部', 'handcraft' => 'ニコニコ手芸部', 'make' => '作ってみた', 'anime' => 'アニメ', 'game' => 'ゲーム', 'toho' => '東方', 'imas' => 'アイドルマスター', 'radio' => 'ラジオ', 'draw' => '描いてみた', 'are' => '例のアレ', 'diary' => '日記', 'other' => 'その他', 'r18' => 'R-18', 'original' => 'オリジナル', 'portrait' => '似顔絵', 'character' => 'キャラクター');
     $user = User::where('screen_name', '=', $screen_name)->first();
     $star_items = $this->getStars($screen_name);
     try {
         $items = Item::where('user_id', '=', $user->id)->orderby('created_at', 'desc')->take(10)->get();
         foreach ($items as &$item) {
             $item['user'] = User::where('id', '=', $item->user_id)->get()[0];
             $item['star_count'] = Starmap::where('item_id', '=', $item->id)->count();
             $item['comment_count'] = Comment::where('item_id', '=', $item->id)->count();
             if ($item->category_id != 0) {
                 $item['category'] = Category::where('id', '=', $item->category_id)->get()[0]->content;
             }
         }
         $works = Work::where('user_id', '=', $user->id)->orderby('created_at', 'desc')->take(10)->get();
         foreach ($works as &$work) {
             $item = Item::where('id', '=', $work->item_id)->get()[0];
             $work['item'] = $item;
             $work['user'] = User::where('id', '=', $work->user_id)->get()[0];
             $work['item']['user'] = User::where('id', '=', $work->item->user_id)->get()[0];
             if ($item->category_id) {
                 $work['item_category'] = Category::where('id', '=', $item->category_id)->get()[0]->content;
             }
         }
         $twitter_profile = array('user' => $user, 'items' => $items, 'title' => $screen_name, 'stars' => $star_items, 'works' => $works, 'categories' => $category_names, 'star_count' => Starmap::where('user_id', '=', $user->id)->count(), 'work_count' => Work::where('user_id', '=', $user->id)->count());
         return View::make('user', $twitter_profile);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:return-zero,项目名称:ma9,代码行数:34,代码来源:UserController.php

示例2: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             case '404':
                 \Log::error($e);
                 return \Response::view('errors.404');
                 break;
             case '500':
                 \Log::error($exception);
                 return \Response::view('errors.500');
                 break;
             default:
                 \Log::error($e);
                 return \Response::view('errors.default');
                 //return $this->renderHttpException($e);
                 break;
         }
     } else {
         if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
             \Log::error($e);
             return \Response::view('errors.default');
         }
         return parent::render($request, $e);
     }
     // return parent::render($request, $e);
 }
开发者ID:ricardo-domingues,项目名称:memoryGame,代码行数:34,代码来源:Handler.php

示例3: render

 /**
  * Returns document with all sitemap items from $items array
  *
  * @param string $format (options: xml, html, txt, ror-rss, ror-rdf)
  *
  * @return View
  */
 public function render($format = 'xml')
 {
     if (empty($this->link)) {
         $this->link = Config::get('application.url');
     }
     if (empty($this->title)) {
         $this->title = 'Sitemap for ' . $this->link;
     }
     $channel = array('title' => $this->title, 'link' => $this->link);
     switch ($format) {
         case 'ror-rss':
             return Response::make(Response::view('sitemap::ror-rss', array('items' => $this->items, 'channel' => $channel)), 200, array('Content-type' => 'text/rss+xml; charset=utf-8'));
             break;
         case 'ror-rdf':
             return Response::make(Response::view('sitemap::ror-rdf', array('items' => $this->items, 'channel' => $channel)), 200, array('Content-type' => 'text/rdf+xml; charset=utf-8'));
             break;
         case 'html':
             return Response::make(Response::view('sitemap::html', array('items' => $this->items, 'channel' => $channel)), 200, array('Content-type' => 'text/html'));
             break;
         case 'txt':
             return Response::make(Response::view('sitemap::txt', array('items' => $this->items, 'channel' => $channel)), 200, array('Content-type' => 'text/plain'));
             break;
         default:
             return Response::make(Response::view('sitemap::xml', array('items' => $this->items)), 200, array('Content-type' => 'text/xml; charset=utf-8'));
     }
 }
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:33,代码来源:sitemap.php

示例4: getReset

 /**
  * Display the password reset view for the given token.
  *
  * @param  string  $token
  * @return Response
  */
 public function getReset($token = null)
 {
     if (is_null($token)) {
         return Response::view('errors.missing', array(), 404);
     }
     return View::make('password.reset')->with('token', $token);
 }
开发者ID:jensz12,项目名称:TechnicSolder,代码行数:13,代码来源:RemindersController.php

示例5: run

 public static function run()
 {
     $currentPath = substr($_SERVER['REQUEST_URI'], 44);
     $currentMethod = $_SERVER['REQUEST_METHOD'];
     if (strpos($currentPath, '?') !== false) {
         $currentPath = explode('?', $currentPath);
         $currentPath = $currentPath[0];
     }
     foreach (static::$routes as $value) {
         $matches[] = array();
         if (preg_match($value['path'], $currentPath, $matches) === 0) {
             continue;
         }
         if ($currentMethod !== $value['method']) {
             continue;
         }
         unset($matches[0]);
         $controller = new $value['class']();
         $info = new \ReflectionMethod($controller, $value['function']);
         if ($info->getNumberOfParameters() !== count($matches)) {
             throw new \Exception('Numero de parametros incorrecto: ' . $value['class'] . '::' . $value['function']);
         }
         $response = $info->invokeArgs($controller, $matches);
         if (is_null($response)) {
             return;
         }
         if ($response instanceof View) {
             Response::view($response);
         }
         return;
     }
     // Lanzar 404
     App::abort(404, 'No se encuentra la ruta');
 }
开发者ID:albertomoreno,项目名称:web-newspaper,代码行数:34,代码来源:Router.php

示例6: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof MethodNotAllowedHttpException) {
         return \Response::view('custom.404');
     }
     //foolant
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             case '404':
                 //\Log::error($e);
                 return \Response::view('custom.404');
                 break;
             case '500':
                 kd('test');
                 //\Log::error($exception);
                 return \Response::view('custom.500');
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     }
     //end
     return parent::render($request, $e);
 }
开发者ID:ycms,项目名称:framework,代码行数:32,代码来源:Handler.php

示例7: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             // not authorized
             case 403:
                 return \Response::view('errors.403', array(), 403);
                 break;
                 // not found
             // not found
             case 404:
                 return \Response::view('errors.404', array(), 404);
                 break;
                 // internal error
             // internal error
             case '500':
                 return \Response::view('errors.500', array(), 500);
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     } else {
         return parent::render($request, $e);
     }
 }
开发者ID:schel4ok,项目名称:steklo,代码行数:33,代码来源:Handler.php

示例8: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             case '404':
                 \Log::error($e);
                 return \Response::view('errors.404');
                 break;
             case '500':
                 \Log::error($e);
                 return \Response::view('errors.500');
                 break;
             case '503':
                 \Log::error($e);
                 return \Response::view('errors.503');
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     } else {
         //return parent::render($request, $e);
         return \Response::view('errors.failure');
     }
 }
开发者ID:luigilapa,项目名称:CuentasFacturas,代码行数:32,代码来源:Handler.php

示例9: index

 /**
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // Use content negotiation to determine the correct format to return
     $negotiator = new \Negotiation\FormatNegotiator();
     $acceptHeader = Request::header('accept');
     // Set priorities to json (if the app requests json provide it in favor of html)
     $priorities = array('application/json', 'text/html', '*/*');
     // Get the best appropriate content type
     $result = $negotiator->getBest($acceptHeader, $priorities);
     // Default to html if $result is not set
     $val = "text/html";
     if (isset($result)) {
         $val = $result->getValue();
     }
     // See what kind of content we should return
     switch ($val) {
         case "text/html":
             // In case we want to return html, just let
             // Laravel render the view and send the headers
             return Response::view('route.planner')->header('Content-Type', "text/html")->header('Vary', 'accept');
             break;
         case "application/json":
         default:
             // In case we want to return JSON(LD) or something else, generate
             // our JSON by calling our static function 'getJSON()'
             return Response::make($this::getJSON())->header('Content-Type', "application/json")->header('Vary', 'accept');
             break;
     }
 }
开发者ID:elroyK,项目名称:hyperRail,代码行数:32,代码来源:RouteController.php

示例10: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     // LM: 09-02-2015
     // See: http://stackoverflow.com/questions/29115184/laravel-catch-tokenmismatchexception
     if ($e instanceof \Illuminate\Session\TokenMismatchException) {
         // If the erros is a token mismatch
         xplog('A token mismatch error happend', __METHOD__);
         /* @BOOKMARK: TODO For now just log the user out when a token mismatch happens */
         return redirect(route('logout'));
     }
     // See: https://mattstauffer.co/blog/bringing-whoops-back-to-laravel-5
     if ($this->isHttpException($e)) {
         // See: https://laracasts.com/discuss/channels/requests/laravel-5-404-page-driving-me-crazy
         switch ($e->getStatusCode()) {
             case '404':
                 return \Response::view('errors.custom.404');
                 break;
                 /*  case '500':
                         return \Response::view('errors.custom.500');   
                     break; */
             /*  case '500':
                     return \Response::view('errors.custom.500');   
                 break; */
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     }
     if (config('app.debug')) {
         return $this->renderExceptionWithWhoops($e);
     }
     return parent::render($request, $e);
 }
开发者ID:rafaelgandi,项目名称:wasabi_artisan,代码行数:40,代码来源:Handler.php

示例11: login

 public function login()
 {
     $redirect = Session::get('redirect');
     // check we're not already logged in
     if (!Auth::check()) {
         // do auth
         Auth::basic('username');
         //check again
         if (Auth::check()) {
             // auth successful
             $user = Auth::user();
             $user->touchLoggedInDate();
             // update logged_in_at to current datetime
             Auth::login($user, true);
             // login and set remember_token
         } else {
             // auth failed
             $headers = array('WWW-Authenticate' => 'Basic');
             $params = array('title' => 'Login failed', 'message' => 'Invalid username/password.');
             Session::flash('redirect', $redirect);
             return Response::view('message', $params, 401, $headers);
         }
     }
     if ($redirect) {
         return Redirect::to($redirect);
     } else {
         return Redirect::home();
     }
 }
开发者ID:Lord-Simon,项目名称:MangaIndex,代码行数:29,代码来源:UsersController.php

示例12: __construct

 public function __construct()
 {
     $this->userdata = $this->checkUserdata();
     // apply authorization filter
     $this->beforeFilter(function () {
         if (!$this->userdata && Request::segment(1) !== 'login') {
             return Redirect::to('/login');
         }
     });
     // templates for app errors
     App::missing(function ($exception) {
         return Response::view('errors.404_cms', array(), 404);
     });
     App::error(function (Exception $exception, $code) {
         Log::error($exception);
         if ($code == 403) {
             return Response::view('/errors/error_403', array(), 403);
         }
     });
     // shared assets
     Orchestra\Asset::add("bootstrap-css", "assets/css/bootstrap.min.css");
     Orchestra\Asset::add("bootstrap-theme", "assets/css/bootstrap-theme.min.css");
     Orchestra\Asset::add("font-awesome", "assets/css/font-awesome.min.css");
     Orchestra\Asset::add("cms-css", "assets/css/cms.css");
     Orchestra\Asset::add("jquery", "assets/js/jquery.js");
     Orchestra\Asset::add("bootstrap-js", "assets/js/bootstrap.min.js");
     Orchestra\Asset::add("handlers-js", "assets/js/handlers.js");
     // shared views
     View::share("active_menu_id", 1);
     View::share("userdata", $this->userdata);
     // configuration
     Config::set("view.pagination", "common/pagination");
 }
开发者ID:nix222,项目名称:crm-system,代码行数:33,代码来源:BaseController.php

示例13: show

 /**
  * @param $id
  * @return \Illuminate\View\View
  */
 public function show($slug)
 {
     $news = $this->news->getBySlug($slug);
     if ($news === null) {
         return Response::view('errors.missing', array(), 404);
     }
     return view('frontend.news.show', compact('news'));
 }
开发者ID:phillipmadsen,项目名称:deved,代码行数:12,代码来源:NewsController.php

示例14: getEditar

 public function getEditar($id)
 {
     if ($id == 0) {
         return \Response::view('errors.500');
     }
     $proveedor = Proveedores::find($id);
     return view('proveedores.editar', compact('proveedor'));
 }
开发者ID:luigilapa,项目名称:CuentasFacturas,代码行数:8,代码来源:ProveedoresController.php

示例15: getEdit

 public function getEdit($id = 0)
 {
     if ($id == 0) {
         return \Response::view('errors.500');
     }
     $user = User::find($id);
     return view('auth.edituser', compact('user'));
 }
开发者ID:luigilapa,项目名称:CuentasFacturas,代码行数:8,代码来源:AuthController.php


注:本文中的Response::view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。