本文整理汇总了PHP中Illuminate\Support\Facades\Response::view方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::view方法的具体用法?PHP Response::view怎么用?PHP Response::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Response
的用法示例。
在下文中一共展示了Response::view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: frontRouter
public function frontRouter($route = '')
{
// FIXME: Do not process front route for static assets
$app = app();
/** @var \App\Core\Balcon $balcon */
$balcon = $app->make('\\App\\Core\\BalconInterface');
/* Register extensions */
$extensionsContainer = $balcon->getExtensionsContainer();
/* Register route resolvers from all extensions */
event(new RouteResolversRegister($balcon));
/* Process all route resolvers */
/** @var RouteResolverInterface $routeResolver */
foreach ($extensionsContainer->getRouteResolversCollection() as $routeResolver) {
$routeResolver->process($route);
}
if (!$balcon->getRouteResolver()) {
return Response::view('errors.404', array(), 404);
}
/* Register response resolvers from all extensions */
event(new ResponseResolversRegister($balcon));
/* Process all response resolvers */
/** @var ResponseResolverInterface $responseResolver */
foreach ($extensionsContainer->getResponseResolversCollection() as $responseResolver) {
$responseResolver->process();
}
event(new ResponseRenderBefore($balcon));
return $balcon->getResponseResolver()->renderResponse();
}
示例2: respond
public function respond(Exception $exception)
{
// the default laravel console error handler really sucks - override it
if ($this->isConsole()) {
// if log_error is false and error_log is not set, fatal errors
// should go to STDERR which, in the cli environment, is STDOUT
if (ini_get('log_errors') === "1" && !ini_get('error_log') && $exception instanceof FatalErrorException) {
return '';
}
// if the exception is not fatal, simply echo it and a newline
return $exception . "\n";
}
if ($exception instanceof HttpExceptionInterface) {
$statusCode = $exception->getStatusCode();
$headers = $exception->getHeaders();
} else {
$statusCode = 500;
$headers = array();
}
// if debug is false, show the friendly error message
if ($this->app['config']->get('app.debug') === false) {
if ($this->requestIsJson()) {
return Response::json(array('errors' => array($this->app['translator']->get('smarterror::genericErrorTitle'))), $statusCode, $headers);
} else {
if ($view = $this->app['config']->get('smarterror::error-view')) {
return Response::view($view, array('referer' => $this->app['request']->header('referer')), $statusCode, $headers);
}
}
}
// if debug is true, do nothing and the default exception whoops page is shown
}
示例3: cctray
/**
* Generates an XML file for CCTray.
*
* @param ProjectRepositoryInterface $projectRepository
* @return Response
*/
public function cctray(ProjectRepositoryInterface $projectRepository)
{
$projects = $projectRepository->getAll();
foreach ($projects as $project) {
$project->latest_deployment = $project->deployments->first();
}
return Response::view('cctray', ['projects' => $projects])->header('Content-Type', 'application/xml');
}
示例4: makeResponse
protected function makeResponse(Request $request)
{
if ($request->ajax() || $request->isJson() || $request->wantsJson()) {
return Response::json(['error' => $this->getErrorMessage()], 403);
} else {
$data = ['title' => $this->getErrorTitle(), 'text' => [$this->getErrorMessage()], 'homeUrl' => $this->getHomeUrl()];
return Response::view('c::error', $data, 403);
}
}
示例5: index
public function index()
{
//
$marcas = marcas::with('productos')->get();
$categorias = categorias::all();
$impuestos = impuestos::all();
$categorias_padre = categorias::lista_padres(1);
$atributos = atributos::with('atributos_sub')->get();
return Response::view('app.atributos.atributos_index', compact(['marcas', 'categorias', 'impuestos', 'atributos', 'categorias_padre']));
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->user()->rank == 0) {
if ($request->ajax()) {
return Response::view('errors.401', array(), 401);
} else {
return Response::view('errors.403', array(), 403);
}
}
return $next($request);
}
示例7: returnWidgetError
protected function returnWidgetError($message)
{
// Getting a prefix and jsPath
$prefix = env('SERVER_PREFIX', '');
$jsPath = url(($prefix ? '/' : '') . env('JS_PATH'));
if ($prefix) {
$prefixToPaste = $prefix . '/';
} else {
$prefixToPaste = '';
}
return Response::view('errors.gist.404', ['js_path' => $jsPath, 'prefix' => $prefixToPaste, 'description' => $message], 200);
}
示例8: respond
public function respond(NotFoundHttpException $exception)
{
if ($this->app['config']->get('app.debug') === false) {
if ($this->requestIsJson()) {
$msg = $this->app['translator']->get('smarterror::missingTitle');
return Response::json(array('errors' => array($msg)), 404);
} else {
if ($view = $this->app['config']->get('smarterror::missing-view')) {
return Response::view($view, array('referer' => $this->app['request']->header('referer')), 404);
}
}
}
}
示例9: raw
public function raw($prefix, $selectedYear, $number)
{
try {
$journal = JournalDao::findByPrefix($prefix);
$edition = EditionDao::findByJournalIdAndYearNumber($journal->journal_id, $selectedYear, $number);
} catch (NoElementException $e) {
App::abort(404, 'Edition not found');
}
$articles = ArticleDao::findByEdition($edition->journal_edition_id);
foreach ($articles as $article) {
$fileName = ArticleService::getArticleFileName($prefix, $selectedYear, $number, $article->sort_order);
$article->fileName = $fileName;
}
return Response::view('edition.raw', compact('articles'))->header('Content-Type', 'text/plain');
}
示例10: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
//verificar si la caja esta abierta
$caja_abierta = caja::CajaAbierta();
if (!isset($caja_abierta)) {
Session::flash('mensaje', 'Primero debe abrir al caja para vender');
return redirect('caja');
}
$productos = Bodegas::with('productos_configurables.productos')->get()->toJson();
$clientes = clientes::all();
$categorias = categorias::orderBy('level')->get();
$tiendas = tiendas::lists('tienda', 'id');
$ciudades = ciudades::all()->toJson();
$departamentos = departamentos::lists('departamento', 'id');
return Response::view('app.ventas.ventas_pos', compact('tiendas', 'categorias', 'productos', 'clientes', 'ciudades', 'departamentos'));
}
示例11: 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)
{
// Make sure a 404 is thrown for:
// ModelNotFound
// ReflectionException
// BadMethodCallException
if ($e instanceof ModelNotFoundException || $e instanceof ReflectionException || $e instanceof BadMethodCallException) {
return Response::view('errors.404', ['exception' => $e], 404);
} else {
if ($e->getStatusCode() == 503) {
return Response::view('errors.503', ['exception' => $e], 503);
} else {
return Response::view('errors.500', ['exception' => $e], 500);
}
}
return parent::render($request, $e);
}
示例12: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (empty($this->auth->user()->arma)) {
if ($request->ajax()) {
return Response::view('errors.401', array(), 401);
} else {
return redirect('/profil')->with('error', 'Veuillez indiquez votre ID Arma 3');
}
}
if ($this->auth->user()->arma) {
$players = DB::table('players')->where('playerid', $this->auth->user()->arma)->first();
if (empty($players)) {
if ($request->ajax()) {
return Response::view('errors.401', array(), 401);
} else {
return redirect('/profil')->with('error', 'L\'ID Arma que vous avez renseigné est invalide, veuillez contacter un support pour effectuer le changement');
}
}
}
return $next($request);
}
示例13: respond
public function respond(TokenMismatchException $exception)
{
$notDebug = $this->app['config']->get('app.debug') === false;
$request = $this->app['request'];
if ($notDebug && $this->requestIsJson($request)) {
return Response::json(array('errors' => array($this->app['translator']->get('smarterror::error.csrfText'))), 400);
}
// if the request has the referer header, it's safe to redirect back to
// the previous page with an error message. this way, no user input
// is lost if a browser tab has been left open too long or something
$referer = $request->header('referer');
// make sure the referer url is not the same as the current page url,
// and that the method is not GET - this prevents a redirect loop
$current = $request->fullUrl();
$method = $request->getMethod();
if ($referer && $referer != $current && $method != 'GET') {
return $this->app['redirect']->back()->withInput()->withErrors($this->app['translator']->get('smarterror::error.csrfText'));
}
if ($notDebug && ($view = $this->app['config']->get('smarterror::csrf-view'))) {
return Response::view($view, array('referer' => $request->header('referer')), 400);
}
}
示例14: respond
/**
* Respond
*
* Generates a response according to the detected format.
* @param mixed $data Data to pass to response
* @param string $view Full name of view
* @param integer $status HTTP status code
* @param array $headers Headers to pass to response
* @return \Illuminate\Http\Response Laravel response
*/
protected function respond($data, $view = '', $status = 200, $headers = array())
{
$format = $this->getFormat();
switch ($format) {
case 'xml':
case 'txt':
/* Ensure resource views are in an expected directory.
* @example The request is for a blog post in XML format. The
* view name should be the default path for html rendering (e.g.
* "post.show"). The final path will be resources.xml.post.show.
* This is to keep API-aimed views separate from standard HTML
* ones.
*/
if (!empty($view)) {
if (strpos($view, $format) === false) {
$view = $format . '.' . $view;
}
if (strpos($view, 'resources') === false) {
$view = 'resources.' . $view;
}
}
// fall through to html handling
// fall through to html handling
case 'html':
if (!empty($view)) {
$response = Response::view($view, $data, $status, $headers);
} else {
$response = Response::make(Collection::make($data)->flatten()->implode(0, "\n"), $status, $headers);
}
break;
default:
$json = isset($data['json']) ? $data['json'] : $data;
$response = Response::json($json, $status, $headers);
break;
}
return $response;
}
示例15: author
public function author($page)
{
$authors = AuthorDao::find(($page - 1) * self::SITEMAP_SIZE, self::SITEMAP_SIZE);
return Response::view('sitemap.author', compact('authors'))->header('Content-Type', 'application/xml');
}