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


PHP Factory::share方法代码示例

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


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

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $this->request = $request;
     $this->view->share('now', Carbon::now());
     $this->response = $next($this->request);
     $this->buildCsp();
     return $this->response;
 }
开发者ID:BePsvPT,项目名称:CCUSA,代码行数:15,代码来源:PreprocessMiddleware.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // If the current session has an "errors" variable bound to it, we will share
     // its value with all view instances so the views can easily access errors
     // without having to bind. An empty bag is set when there aren't errors.
     $this->view->share('errors', $request->session()->get('errors') ?: new ViewErrorBag());
     // Putting the errors in the view for every view allows the developer to just
     // assume that some errors are always available, which is convenient since
     // they don't have to continually run checks for the presence of errors.
     return $next($request);
 }
开发者ID:bmitch,项目名称:framework,代码行数:18,代码来源:ShareErrorsFromSession.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // If the current session has an "errors" variable bound to it, we will share
     // its value with all view instances so the views can easily access errors
     // without having to bind. An empty bag is set when there aren't errors.
     if ($request->session()->has('errors')) {
         $this->view->share('errors', $request->session()->get('errors'));
     } else {
         $this->view->share('errors', new ViewErrorBag());
     }
     return $next($request);
 }
开发者ID:scrobot,项目名称:Lumen,代码行数:19,代码来源:ShareErrorsFromSession.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->session()->has('infos')) {
         $this->view->share('infos', $request->session()->get('infos'));
     } else {
         $this->view->share('infos', new MessageBag());
     }
     if ($request->session()->has('warnings')) {
         $this->view->share('warnings', $request->session()->get('warnings'));
     } else {
         $this->view->share('warnings', new MessageBag());
     }
     return $next($request);
 }
开发者ID:sixbyter,项目名称:laradmin,代码行数:21,代码来源:ShareMessageFromSession.php

示例5: function

 function it_shares_the_notifications_from_the_session(Notifier $notifier, Factory $viewFactory, Request $request)
 {
     $notifications = Notifications::mapFromArray([]);
     $notifier->getCurrentNotifications()->willReturn($notifications);
     $viewFactory->share('notifications', $notifications)->shouldBeCalled();
     $next = function ($req) use($request) {
         return $req === $request->getWrappedObject();
     };
     $this->handle($request, $next)->shouldBe(true);
 }
开发者ID:rojtjo,项目名称:notifier-laravel,代码行数:10,代码来源:ShareNotificationsWithViewSpec.php

示例6: share

 /**
  * @param $key
  * @param null $value
  */
 protected function share($key, $value = null)
 {
     $this->view->share($key, $value);
 }
开发者ID:darrengopower,项目名称:framework,代码行数:8,代码来源:Controller.php

示例7: share

 /**
  * @param $key
  * @param $value
  */
 public function share($key, $value)
 {
     $this->view->share($key, $value);
 }
开发者ID:darrengopower,项目名称:framework,代码行数:8,代码来源:OnCategoryShow.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param Request $request
  * @param Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $notifications = $this->notifier->getCurrentNotifications();
     $this->viewFactory->share('notifications', $notifications);
     return $next($request);
 }
开发者ID:rojtjo,项目名称:notifier-laravel,代码行数:13,代码来源:ShareNotificationsWithView.php

示例9: __construct

 /**
  * @param \Codex\Codex                         $codex
  * @param \Illuminate\Contracts\View\Factory|\Illuminate\View\Factory $view
  */
 public function __construct(Codex $codex, ViewFactory $view)
 {
     $this->codex = $codex;
     $this->view = $view;
     $view->share('codex', $codex);
 }
开发者ID:codexproject,项目名称:core,代码行数:10,代码来源:Controller.php

示例10: setGlobalViewVariables

 protected function setGlobalViewVariables()
 {
     $this->view->share('guard', $this->guard);
     $this->view->share('version', Entity::VERSION);
 }
开发者ID:BePsvPT,项目名称:CCU,代码行数:5,代码来源:PreprocessConnection.php

示例11: handle

 /**
  * Middleware handler.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle(Request $request, \Closure $next)
 {
     $this->view->share('errors', $request->session()->get('messages') ?: new ViewErrorBag());
     return $next($request);
 }
开发者ID:notadd,项目名称:framework,代码行数:13,代码来源:ShareMessagesFromSession.php


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