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


PHP Factory::share方法代码示例

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


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

示例1: plant

 /**
  * Plant a new bonsai collection!
  *
  * @param  string  $namespace
  * @param  string  $path
  * @return null
  */
 public function plant($callback = null)
 {
     $assets = new Assets();
     if (is_callable($callback)) {
         call_user_func($callback, $assets);
     }
     $this->collection->put('bonsai', $assets);
     $this->view->share('bonsai', $assets);
     return $assets;
 }
开发者ID:caffeinated,项目名称:bonsai,代码行数:17,代码来源:Bonsai.php

示例2: make

 /**
  * Create a new menu instance.
  *
  * @param  string    $name
  * @param  callable  $callback
  * @return \Caffeinated\Menus\Builder
  */
 public function make($name, $callback)
 {
     if (is_callable($callback)) {
         $menu = new Builder($name, $this->loadConfig($name), $this->html, $this->url);
         call_user_func($callback, $menu);
         $this->collection->put($name, $menu);
         $this->view->share('menu_' . $name, $menu);
         return $menu;
     }
 }
开发者ID:tok3,项目名称:menus,代码行数:17,代码来源:Menu.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $this->app->setLocale($this->settings->get('user.language', 'en'));
     $langDir = ['left' => 'left', 'right' => 'right'];
     if (trans('general.direction') == 'rtl') {
         $langDir['left'] = 'right';
         $langDir['right'] = 'left';
     }
     $this->viewFactory->share('langDir', $langDir);
     return $next($request);
 }
开发者ID:Adamzynoni,项目名称:mybb2,代码行数:19,代码来源:SetupLanguage.php

示例4: make

 /**
  * Create a new menu instance.
  *
  * @param string   $name
  * @param callable $callback
  *
  * @return \Kiwina\Menu\Menu
  */
 public function make($name, $callback)
 {
     if (is_callable($callback)) {
         $menu = new Builder($name, $this->loadConf($name), $this->html, $this->url);
         // Registering the items
         call_user_func($callback, $menu);
         // Storing each menu instance in the collection
         $this->collection->put($name, $menu);
         // Make the instance available in all views
         $this->view->share($name, $menu);
         return $menu;
     }
 }
开发者ID:kiwina,项目名称:laravel5-menu,代码行数:21,代码来源:Menu.php

示例5: boot

 /**
  * Bootstrap the application services
  *
  * @param ViewFactory $viewFactory
  */
 public function boot(ViewFactory $viewFactory)
 {
     if (is_dir(base_path() . '/resources/views/viktorv/lpanel')) {
         $this->loadViewsFrom(base_path() . '/resources/views/viktorv/lpanel', 'lpanel');
     } else {
         $path = realpath(__DIR__ . '/../resources/views');
         /** @var \League\Plates\Engine $platesEngine */
         $platesEngine = $this->app->make('League\\Plates\\Engine');
         $platesEngine->setDirectory($path);
         $platesEngine->addFolder('layout', $path . '/admin/layout');
         $platesEngine->addFolder('noscript', $path . '/noscript');
         $this->loadViewsFrom($path, 'lpanel');
     }
     /** @var \Illuminate\Validation\Factory $validator */
     $validator = $this->app->validator;
     $validator->resolver(function ($translator, $data, $rules, $messages) {
         return new Validator($translator, $data, $rules, $messages);
     });
     $viewFactory->share('block', new BaseBlock($this->app));
     if (is_dir(base_path() . '/resources/lang/viktorv/lpanel')) {
         $this->loadTranslationsFrom(base_path() . '/resources/lang/viktorv/lpanel', 'lpanel');
     } else {
         $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'lpanel');
     }
 }
开发者ID:Viktor-V,项目名称:LPanel,代码行数:30,代码来源:AdminServiceProvider.php

示例6: shareTitle

 private function shareTitle()
 {
     $langKey = "titles.{$this->router->currentRouteName()}";
     if ($this->lang->has($langKey)) {
         $this->view->share('title', $this->lang->get($langKey));
     }
 }
开发者ID:reshadman,项目名称:hammihan-online,代码行数:7,代码来源:Settings.php

示例7: share

 /**
  * Add a piece of shared data to the factory.
  *
  * @param  string  $key
  * @param  mixed   $value
  * @return void
  */
 public function share($key, $value = null)
 {
     if (!is_array($key)) {
         return parent::share($key, $this->decorate($value));
     }
     return parent::share($this->decorate($key));
 }
开发者ID:robclancy,项目名称:presenter,代码行数:14,代码来源:Factory.php

示例8: register

 public function register(Container $pimple)
 {
     $pimple['files'] = function () {
         return new Filesystem();
     };
     $pimple['view.engine.resolver'] = function () use($pimple) {
         $resolver = new EngineResolver();
         foreach (['php', 'blade'] as $engine) {
             $this->{'register' . ucfirst($engine) . 'Engine'}($resolver, $pimple);
         }
         return $resolver;
     };
     $pimple['view.finder'] = function () use($pimple) {
         $paths = $pimple['config']['view.paths'];
         return new FileViewFinder($pimple['files'], $paths);
     };
     $pimple['view'] = function () use($pimple) {
         // Next we need to grab the engine resolver instance that will be used by the
         // environment. The resolver will be used by an environment to get each of
         // the various engine implementations such as plain PHP or Blade engine.
         $resolver = $pimple['view.engine.resolver'];
         $finder = $pimple['view.finder'];
         $env = new Factory($resolver, $finder, $pimple['events']);
         // We will also set the container instance on this view environment since the
         // view composers may be classes registered in the container, which allows
         // for great testable, flexible composers for the application developer.
         $env->setContainer($pimple['container']);
         $env->share('app', $pimple);
         return $env;
     };
 }
开发者ID:skyguest,项目名称:ecadapter,代码行数:31,代码来源:ViewServiceProvider.php

示例9: __construct

 public function __construct(Store $session, Factory $view)
 {
     $this->session = $session;
     $view->share('flash', $this);
     if ($this->session->has($this->namespace)) {
         $flashed = $this->session->get($this->namespace);
         $this->message = $flashed['message'];
         $this->title = $flashed['title'];
         $this->type = $flashed['type'];
         $this->exists = true;
     }
 }
开发者ID:willishq,项目名称:laravel5-flash,代码行数:12,代码来源:Flash.php

示例10: loadMocks

 private function loadMocks(View $view)
 {
     $events = [1 => ['/img/event-sample1.jpg', 'iMasters Developer Week RJ', 'Rio de Janeiro, Brazil'], 2 => ['/img/event-sample2.jpg', 'PHP\'n Rio 2011', 'Rio de Janeiro, Brazil'], 3 => ['/img/event-sample3.jpg', 'PHPConf 2015', 'Osasco, Brazil'], 4 => ['/img/event-sample4.jpg', 'TDCOnline 2015 POA', 'Porto Alegre, Brazil'], 5 => ['/img/event-sample5.jpg', 'O\'Reilly\'s Fluent', 'San Francisco, USA'], 6 => ['/img/event-sample6.gif', 'UERJ Sem Muros', 'Rio de Janeiro, Brazil'], 7 => ['/img/event-sample7.jpg', '53º Congresso HUPE', 'Rio de Janeiro, Brazil'], 8 => ['/img/event-sample8.png', 'XXVI Congresso Brasileiro de Virologia', 'Florianópolis, Brazil']];
     foreach ($events as $i => &$event) {
         $event[] = time();
         $event[] = $i % 2 ? time() + 60 * 60 * 24 * 3 : null;
         $event[] = 'Fusce pellentesque velvitae tincidunt egestas. Pellentesque habitant morbi. Proin gravida nibh vel velit auctor aliquet. Aenean sollicitudin, lorem quis.
         Bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit. Duis sed odio sit amet nibh vulputate cursus a sit amet mauris.';
         $event[] = (bool) rand(0, 1);
         $event[] = 'http://www.google.com.br';
         $event[] = 'konato';
         $event[] = 'konato2015';
     }
     $types = [_('Congresses'), _('Meetings'), _('Talks & discussions'), _('University meetings'), _('Cultural')];
     $selected_types = array_rand($types, 2);
     $themes = explode(' ', 'PHP Databases MySQL Webdesign APIs');
     $selected_themes = array_rand($themes, 2);
     $speakers = [['/img/speaker-sample1.jpg', 'Fabio Akita', 'São Paulo, Brazil', ['Ruby', 'Agile', 'Speaking']], ['/img/speaker-sample2.jpg', 'Raphael de Almeida', 'Rio de Janeiro, Brazil', ['PHP', 'Microsserviços', 'Ruby']], ['/img/speaker-sample3.jpg', 'Valéria Parajara', 'Rio de Janeiro, Brazil', ['Ruby', 'Gastronomia']], ['/img/speaker-sample4.jpg', 'Pedro Couteiro', 'Tsukuba, Japan', ['CG', 'Java', 'Japanese']], ['/img/speaker-sample5.jpg', 'Luan Rodrigues', 'Rio de Janeiro, Brazil', ['Computação médica', 'Cirurgia plástica']], ['/img/speaker-sample6.jpg', 'Igor Santos', 'Halifax, Canada', ['Web Services', 'PHP']]];
     foreach ($speakers as $i => &$speaker) {
         $speaker[] = rand(5, 15);
         $speaker[] = rand(15, 50);
         $speaker[] = 'Fusce pellentesque velvitae tincidunt egestas. Pellentesque habitant morbi.';
         $speaker[] = ['M', 'M', 'F', 'M', 'M', 'M'][$i];
     }
     $materials = [['http://www.google.com', 'How to be Agile in Project Management', 'doc', $speakers[1]], ['http://pt.slideshare.net/igorsantos07/rest-fuuuu-54458320', 'The RESTful Police', 'slide', $speakers[5]], ['http://www.google.com', 'Immobilized lipase reutilization on biodiesel syntesis from soy oil', 'doc', $speakers[3]], ['http://www.google.com', 'How to launch a culinary business having an IT background', 'video', $speakers[2]]];
     shuffle($events);
     shuffle($speakers);
     $view->share('events', $events);
     //        $view->share('types', $types);
     $view->share('selected_types', $selected_types);
     $view->share('themes', $themes);
     $view->share('selected_themes', $selected_themes);
     $view->share('speakers', $speakers);
     $view->share('materials', $materials);
 }
开发者ID:konato-events,项目名称:web,代码行数:35,代码来源:AppServiceProvider.php

示例11: makeView

 protected function makeView()
 {
     $app = new Container();
     $resolver = new EngineResolver();
     $resolver->register('php', function () {
         return new PhpEngine();
     });
     $finder = new FileViewFinder(new Filesystem(), [realpath(__DIR__)]);
     $dispatcher = (new Dispatcher($app))->setQueueResolver(function () use($app) {
         return $app->make('Illuminate\\Contracts\\Queue\\Factory');
     });
     $env = new Factory($resolver, $finder, $dispatcher);
     $env->setContainer($app);
     $env->share('app', $app);
     return new Illuminate($env);
 }
开发者ID:michaeljennings,项目名称:carpenter,代码行数:16,代码来源:IlluminateViewTest.php

示例12: registerFactory

 /**
  * Register the view environment.
  *
  * @return void
  */
 public function registerFactory()
 {
     $this->app->singleton('view', function ($app) {
         // Next we need to grab the engine resolver instance that will be used by the
         // environment. The resolver will be used by an environment to get each of
         // the various engine implementations such as plain PHP or Blade engine.
         $resolver = $app['view.engine.resolver'];
         $finder = $app['view.finder'];
         $env = new Factory($resolver, $finder, $app['events']);
         // We will also set the container instance on this view environment since the
         // view composers may be classes registered in the container, which allows
         // for great testable, flexible composers for the application developer.
         $env->setContainer($app);
         $env->share('app', $app);
         return $env;
     });
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:22,代码来源:ViewServiceProvider.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Share the authenticated user to make sure we have a decorated version of it
     $this->viewFactory->share('auth_user', $this->guard->user());
     return $next($request);
 }
开发者ID:Adamzynoni,项目名称:mybb2,代码行数:14,代码来源:ShareViewVariables.php

示例14: render

 /**
  * Get the string contents of the view.
  *
  * @param Request $request
  * @return string
  */
 public function render(Request $request)
 {
     $forum = $this->getForumDocument($request);
     $this->view->share('translator', $this->locales->getTranslator());
     $this->view->share('allowJs', !array_get($request->getQueryParams(), 'nojs'));
     $this->view->share('forum', array_get($forum, 'data'));
     $this->view->share('debug', array_get($forum, 'data.attributes.debug'));
     $view = $this->view->file(__DIR__ . '/../../../views/app.blade.php');
     $view->title = $this->buildTitle(array_get($forum, 'data.attributes.title'));
     $view->description = $this->description;
     $view->modules = $this->modules;
     $view->payload = $this->buildPayload($request, $forum);
     $view->layout = $this->buildLayout();
     $baseUrl = array_get($forum, 'data.attributes.baseUrl');
     $view->cssUrls = $this->buildCssUrls($baseUrl);
     $view->jsUrls = $this->buildJsUrls($baseUrl);
     $view->head = implode("\n", $this->head);
     $view->foot = implode("\n", $this->foot);
     return $view->render();
 }
开发者ID:skywalker512,项目名称:FlarumChina,代码行数:26,代码来源:WebAppView.php

示例15: shareDataToViews

 /**
  * Shares the required data for the reCAPTCHA
  *
  * @return void
  */
 public function shareDataToViews()
 {
     $this->view->share('captcha_validation_url', $this->mockably->route('larapress.api.captcha.validate.post'));
 }
开发者ID:LaraGit,项目名称:larapress,代码行数:9,代码来源:Captcha.php


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