• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Routing\ResponseFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Illuminate\Routing\ResponseFactory的典型用法代码示例。如果您正苦于以下问题:PHP ResponseFactory类的具体用法?PHP ResponseFactory怎么用?PHP ResponseFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: handle

 /**
  * Handle the command.
  *
  * @param ResponseFactory $response
  */
 public function handle(ResponseFactory $response)
 {
     $tree = $this->builder->getTree();
     $options = $tree->getOptions();
     $data = $tree->getData();
     $tree->setResponse($response->view($options->get('wrapper_view', 'streams::blank'), $data));
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:12,代码来源:SetTreeResponse.php


示例2: handle

 /**
  * Handle the command.
  *
  * @param ResponseFactory $response
  */
 public function handle(ResponseFactory $response)
 {
     $table = $this->builder->getTable();
     $options = $table->getOptions();
     $data = $table->getData();
     $table->setResponse($response->view($options->get('wrapper_view', $this->builder->isAjax() ? 'streams::ajax' : 'streams::blank'), $data));
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:12,代码来源:SetTableResponse.php


示例3: handle

 /**
  * Handle the command.
  *
  * @param ResponseFactory $response
  * @param Request         $request
  */
 public function handle(ResponseFactory $response, Request $request)
 {
     /* @var TableBuilder $builder */
     foreach ($this->builder->getTables() as $builder) {
         $builder->post();
     }
     if (!$this->builder->getTableResponse()) {
         $this->builder->setTableResponse($response->redirectTo($request->fullUrl()));
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:16,代码来源:PostTables.php


示例4: handle

 /**
  * Handle the command.
  *
  * @param  Request         $request
  * @param  ResponseFactory $response
  * @throws \Exception
  */
 public function handle(Request $request, ResponseFactory $response)
 {
     if ($this->builder instanceof MultipleTableBuilder) {
         return;
     }
     $this->dispatch(new ExecuteAction($this->builder));
     if (!$this->builder->getTableResponse()) {
         $this->builder->setTableResponse($response->redirectTo($request->fullUrl()));
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:17,代码来源:PostTable.php


示例5: handle

 /**
  * ExportAll the selected entries.
  *
  * @param TableBuilder    $builder
  * @param ResponseFactory $response
  * @param array           $selected
  */
 public function handle(TableBuilder $builder, ResponseFactory $response, array $selected)
 {
     $model = $builder->getTableModel();
     $stream = $builder->getTableStream();
     $headers = ['Content-Disposition' => 'attachment; filename=' . $stream->getSlug() . '.csv', 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0', 'Content-type' => 'text/csv', 'Pragma' => 'public', 'Expires' => '0'];
     $callback = function () use($selected, $model) {
         $output = fopen('php://output', 'w');
         /* @var EloquentModel $entry */
         foreach ($model->all() as $k => $entry) {
             if ($k == 0) {
                 fputcsv($output, array_keys($entry->toArray()));
             }
             fputcsv($output, $entry->toArray());
         }
         fclose($output);
     };
     $builder->setTableResponse($response->stream($callback, 200, $headers));
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:25,代码来源:ExportAll.php


示例6: ajax

 /**
  * @param HostnameRepositoryContract $hostname
  * @param ResponseFactory            $response
  * @return \Illuminate\Http\JsonResponse
  */
 public function ajax(HostnameRepositoryContract $hostname, ResponseFactory $response)
 {
     return $response->json($hostname->ajaxQuery('hostname'));
 }
开发者ID:hyn,项目名称:management-interface,代码行数:9,代码来源:HostnameController.php


示例7: handle

 /**
  * Handle the command.
  *
  * @param ResponseFactory $response
  */
 public function handle(ResponseFactory $response)
 {
     $this->builder->setFormResponse($response->json(['errors' => $this->builder->getFormErrors()->getMessages(), 'redirect' => $this->builder->getFormOption('redirect', $this->builder->getFormActions()->active()->getRedirect())]));
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:9,代码来源:SetJsonResponse.php


示例8: handle

 /**
  * Handle the command.
  *
  * @param ResponseFactory $response
  */
 public function handle(ResponseFactory $response)
 {
     $options = $this->builder->getFormOptions();
     $data = $this->builder->getFormData();
     $this->builder->setFormResponse($response->view($options->get('wrapper_view'), $data));
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:11,代码来源:SetFormResponse.php


示例9: handle

 public function handle(ResponseFactory $factory)
 {
     $response = ['data' => $this->content, 'status' => $this->status];
     return $factory->json($response, $this->status, $this->headers, $this->options);
 }
开发者ID:vinelab,项目名称:lucid,代码行数:5,代码来源:RespondWithJsonJob.php


示例10: handle

 public function handle(ResponseFactory $factory)
 {
     return $factory->view($this->template, $this->data, $this->status, $this->headers);
 }
开发者ID:Vinelab,项目名称:lucid,代码行数:4,代码来源:RespondWithViewJob.php


示例11: handle

 public function handle(ResponseFactory $response)
 {
     return $response->json($this->content, $this->status, $this->headers, $this->options);
 }
开发者ID:vinelab,项目名称:lucid,代码行数:4,代码来源:RespondWithJsonErrorJob.php


示例12: hasMacro

 /**
  * Checks if macro is registered.
  *
  * @param string $name
  * @return bool 
  * @static 
  */
 public static function hasMacro($name)
 {
     return \Illuminate\Routing\ResponseFactory::hasMacro($name);
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php


示例13: handle

 public function handle(Larasponse $larasponse, ResponseFactory $response)
 {
     $item = $larasponse->item($this->data, $this->transformer);
     return $response->json($item, $this->status, $this->headers, $this->options);
 }
开发者ID:jebbdomingo,项目名称:lifestutor2,代码行数:5,代码来源:RespondWithJsonJob.php


示例14: authorize

 /**
  * Authorize the page.
  *
  * @param PageInterface $page
  */
 public function authorize(PageInterface $page)
 {
     /* @var UserInterface $user */
     $user = $this->guard->user();
     /**
      * If the page is not enabled and we
      * are not logged in then 404.
      */
     if (!$page->isEnabled() && !$user) {
         abort(404);
     }
     /**
      * If the page is not enabled and we are
      * logged in then make sure we have permission.
      */
     if (!$page->isEnabled()) {
         $this->authorizer->authorize('anomaly.module.pages::view_drafts');
     }
     /**
      * If the page is restricted to specific
      * roles then make sure our user is one of them.
      */
     $allowed = $page->getAllowedRoles();
     if (!$allowed->isEmpty() && (!$user || !$user->hasAnyRole($allowed))) {
         $page->setResponse($this->response->redirectTo('login'));
     }
 }
开发者ID:visualturk,项目名称:pages-module,代码行数:32,代码来源:PageAuthorizer.php


示例15: make

 /**
  * Make the response.
  *
  * @param FileInterface $file
  * @return Response
  */
 public function make(FileInterface $file)
 {
     // Start the response.
     $response = $this->response->make();
     $response->headers->set('Etag', $file->etag());
     $response->headers->set('Content-Type', $file->getMimetype());
     $response->headers->set('Last-Modified', $file->lastModified()->setTimezone('GMT')->format('D, d M Y H:i:s'));
     $response->setTtl(3600);
     return $response;
 }
开发者ID:ramcda,项目名称:files-module,代码行数:16,代码来源:FileResponse.php


示例16: make

 /**
  * Make the response.
  *
  * @param FileInterface $file
  * @return Response
  */
 public function make(FileInterface $file)
 {
     // Start the response.
     $response = $this->response->make();
     $response->headers->set('Pragma', 'public');
     $response->headers->set('Etag', $file->hash());
     $response->headers->set('Content-Length', $file->getSize());
     $response->headers->set('Content-Type', $file->getMimetype());
     $response->headers->set('Cache-Control', 'public,max-age=300,s-maxage=900');
     // Should be configurable
     $response->headers->set('Last-Modified', $file->lastModified()->setTimezone('GMT')->format('D, d M Y H:i:s'));
     return $response;
 }
开发者ID:bloveless,项目名称:files-module,代码行数:19,代码来源:FileResponse.php


示例17: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if ($this->guard->guest()) {
         if ($request->ajax()) {
             return $this->response->make('Unauthorized.', 401);
         } else {
             if ($request->segment(1) === 'admin') {
                 return $this->redirect->guest('admin/login');
             } else {
                 return $this->redirect->guest('login');
             }
         }
     }
     return $next($request);
 }
开发者ID:jacksun101,项目名称:users-module,代码行数:22,代码来源:Authenticate.php


示例18: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     $response = $this->security->check($this->guard->user());
     if ($response instanceof Response) {
         return $response;
     }
     if ($this->guard->guest()) {
         if ($request->ajax()) {
             return $this->response->make('Unauthorized.', 401);
         } else {
             if ($request->segment(1) === 'admin') {
                 return $this->redirect->guest('admin/login');
             } else {
                 return $this->redirect->guest('login');
             }
         }
     }
     return $next($request);
 }
开发者ID:AkibaTech,项目名称:users-module,代码行数:26,代码来源:Authenticate.php


示例19: authorize

 /**
  * Authorize the page.
  *
  * @param PageInterface $page
  */
 public function authorize(PageInterface $page)
 {
     /* @var UserInterface $user */
     $user = $this->guard->user();
     /**
      * If the page is not enabled and we
      * are not logged in then 404.
      */
     if (!$page->isEnabled() && !$user) {
         abort(404);
     }
     /**
      * If the page is not enabled and we are
      * logged in then make sure we have permission.
      */
     if (!$page->isEnabled() && !$this->authorizer->authorize('anomaly.module.pages::view_drafts')) {
         abort(403);
     }
     /**
      * If the page is restricted to specific
      * roles then make sure our user is one of them.
      */
     $allowed = $page->getAllowedRoles();
     /**
      * If there is a guest role and
      * there IS a user then this
      * page can NOT display.
      */
     if ($allowed->has('guest') && $user && !$user->isAdmin()) {
         abort(403);
     }
     // No longer needed.
     $allowed->forget('guest');
     /**
      * Check the roles against the
      * user if there are any.
      */
     if (!$allowed->isEmpty() && (!$user || !$user->hasAnyRole($allowed) && !$user->isAdmin())) {
         $page->setResponse($this->response->redirectGuest('login'));
     }
 }
开发者ID:jacksun101,项目名称:pages-module,代码行数:46,代码来源:PageAuthorizer.php


示例20: search

 /**
  * Search for the vacancies
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $data = $this->vacancy->search($this->request->input('q'), $this->getOptionInputs());
     return $this->response->json(['vacancies' => $data]);
 }
开发者ID:MLoureiro,项目名称:vacancy-repository-trial,代码行数:10,代码来源:VacancyController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Routing\Route类代码示例发布时间:2022-05-23
下一篇:
PHP Routing\Redirector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap