當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。