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

PHP View\Factory类代码示例

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

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



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

示例1: __construct

 public function __construct()
 {
     $this->instance('container', $this);
     $this->singleton('events', function () {
         return new Dispatcher();
     });
     $this->singleton('files', function () {
         return new Filesystem();
     });
     $this->singleton('blade.compiler', function () {
         return new BladeCompiler($this['files'], $this['view.compiled']);
     });
     $this->singleton('view.engine.resolver', function () {
         $resolver = new EngineResolver();
         $resolver->register('blade', function () {
             return new CompilerEngine($this['blade.compiler'], $this['files']);
         });
         $resolver->register('php', function () {
             return new PhpEngine();
         });
         return $resolver;
     });
     $this->singleton('view.finder', function () {
         return new FileViewFinder($this['files'], $this['view.paths']);
     });
     $this->singleton('view', function () {
         $env = new Factory($this['view.engine.resolver'], $this['view.finder'], $this['events']);
         $env->setContainer($this['container']);
         return $env;
     });
 }
开发者ID:ngangchill,项目名称:ronin-blade,代码行数:31,代码来源:Container.php


示例2: 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


示例3: init

 /**
  * Init controller.
  * @param Backend $backend
  * @param ViewFactory $view
  */
 public function init(Backend $backend, ViewFactory $view)
 {
     $backend->setActiveMenu('system.groups');
     $view->composer($this->viewName('groups.form'), function (View $view) use($backend) {
         $view->with('rules', $backend->getAclGroups());
     });
 }
开发者ID:rabbitcms,项目名称:backend,代码行数:12,代码来源:Groups.php


示例4: 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


示例5: init

 /**
  * Controller init.
  * @param Backend $backend
  * @param ViewFactory $view
  */
 public function init(Backend $backend, ViewFactory $view)
 {
     $backend->setActiveMenu('system.users');
     $view->composer($this->viewName('users.form'), function (View $view) {
         $view->with('groups', GroupModel::query()->get());
     });
 }
开发者ID:rabbitcms,项目名称:backend,代码行数:12,代码来源:Users.php


示例6: __construct

 public function __construct(Request $request, Factory $factory)
 {
     $this->request = $request;
     $this->view_path = realpath(base_path('resources/views'));
     $this->factory = $factory;
     $this->finder = $factory->getFinder();
     $this->finder->addExtension('schema.php');
 }
开发者ID:leeduc,项目名称:json-api-builder,代码行数:8,代码来源:Generate.php


示例7: template

 /**
  * Return an angular template partial.
  *
  * @param  \App\Http\Requests\Api\Angular\TemplateRequest  $request
  * @return \Illuminate\View\View
  */
 public function template(TemplateRequest $request)
 {
     $template = $request->get('template');
     if ($this->viewFactory->exists($template)) {
         return $this->viewFactory->make($template);
     }
     return $this->response()->errorNotFound();
 }
开发者ID:kevindierkx,项目名称:uuid-namespace-manager,代码行数:14,代码来源:TemplatesController.php


示例8: composeMessage

 /**
  * Composes a message.
  *
  * @return \Illuminate\View\Factory
  */
 public function composeMessage()
 {
     // Attempts to make a view.
     // If a view can not be created; it is assumed that simple message is passed through.
     try {
         return $this->views->make($this->view, $this->data)->render();
     } catch (\InvalidArgumentException $e) {
         return $this->view;
     }
 }
开发者ID:simplesoftwareio,项目名称:simple-sms,代码行数:15,代码来源:OutgoingMessage.php


示例9: 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


示例10: __construct

 public function __construct(Request $request, Factory $factory, array $data, $sources = [], $meta = [])
 {
     $this->request = $request;
     $this->data = $data;
     $this->sources = $sources;
     $this->factory = $factory;
     $this->finder = $factory->getFinder();
     if ($meta) {
         $this->data['jsonapi'] = array_filter($meta);
     }
 }
开发者ID:leeduc,项目名称:json-api-builder,代码行数:11,代码来源:Parse.php


示例11: expired

 /**
  * Return true if compilation expired.
  *
  * @param \Bladerunner\Blade       $blade
  * @param \Illuminate\View\Factory $view
  * @param string                   $path
  */
 public static function expired($blade, $view, $path)
 {
     $result = false;
     $wp_debug = (bool) defined('WP_DEBUG') && true === WP_DEBUG;
     if ($wp_debug) {
         return true;
     }
     $result = $wp_debug || $result;
     $result = !file_exists($path) || $result;
     $result = $blade->getCompiler()->isExpired($view->getPath()) || $result;
     return $result;
 }
开发者ID:frozzare,项目名称:bladerunner,代码行数:19,代码来源:Cache.php


示例12: getNormalizedName

 /**
  * Get the normalized name, for creator/composer events
  *
  * @param  \Illuminate\View\Factory $viewEnvironment
  * @return string
  */
 protected function getNormalizedName($viewEnvironment)
 {
     $paths = $viewEnvironment->getFinder()->getPaths();
     $name = $this->getTemplateName();
     // Replace absolute paths, trim slashes, remove extension
     $name = str_replace($paths, '', $name);
     $name = ltrim($name, '/');
     if (substr($name, -5, 5) === '.twig') {
         $name = substr($name, 0, -5);
     }
     return $name;
 }
开发者ID:hushulin,项目名称:laratwig,代码行数:18,代码来源:Template.php


示例13: __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


示例14: testAddRenderTemplate

 public function testAddRenderTemplate()
 {
     $this->templateMock2->expects($this->any())->method('setArguments')->will($this->returnValue($this->templateMock2));
     $this->testInstance->add($this->templateMock1, 'first');
     $this->testInstance->add($this->templateMock2, 'second');
     $this->templateMock1->expects($this->once())->method('render')->will($this->returnValue($mock1Val = uniqid()));
     $this->templateMock2->expects($this->any())->method('render')->will($this->returnValue($mock2Val = uniqid()));
     $fakeArgs = ['varName' => uniqid('varName')];
     $this->assertSame($mock1Val, $this->testInstance->straightRender($this->templateMock1));
     $this->assertSame($mock2Val, $this->testInstance->render('second', $fakeArgs));
     $this->viewFactoryMock->expects($this->any())->method('make')->with($viewName = uniqid('viewName'))->will($this->returnValue($this->viewMock));
     $this->assertSame($mock2Val, $this->testInstance->renderOnce('second', $fakeArgs, $viewName));
 }
开发者ID:laravel-commode,项目名称:bladed,代码行数:13,代码来源:TemplateTest.php


示例15: postEmail

 /**
  * Send a reset link to the given user.
  *
  * @param  EmailPasswordLinkRequest  $request
  * @param  Illuminate\View\Factory $view
  * @return Response
  */
 public function postEmail(EmailPasswordLinkRequest $request, Factory $view)
 {
     $view->composer('emails.auth.password', function ($view) {
         $view->with(['title' => trans('front/password.email-title'), 'intro' => trans('front/password.email-intro'), 'link' => trans('front/password.email-link'), 'expire' => trans('front/password.email-expire'), 'minutes' => trans('front/password.minutes')]);
     });
     switch ($response = $this->passwords->sendResetLink($request->only('email'), function ($message) {
         $message->subject(trans('front/password.reset'));
     })) {
         case PasswordBroker::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
         case PasswordBroker::INVALID_USER:
             return redirect()->back()->with('error', trans($response));
     }
 }
开发者ID:arman-interpiar,项目名称:laravel5-example,代码行数:21,代码来源:PasswordController.php


示例16: handle

 /**
  * Handle the command.
  *
  * @param PageRepositoryInterface $pages
  * @return null|PageInterface
  */
 public function handle(PageRepositoryInterface $pages, Factory $view)
 {
     $options = $this->options;
     /* @var PageCollection $pages */
     $pages = $pages->sorted();
     $pages = $pages->visible();
     $this->dispatch(new SetParentRelations($pages));
     $this->dispatch(new RemoveRestrictedPages($pages));
     if ($root = $options->get('root')) {
         if ($page = $this->dispatch(new GetPage($root))) {
             $options->put('parent', $page);
         }
     }
     return $view->make($options->get('view', 'anomaly.module.pages::nav'), compact('pages', 'options'))->render();
 }
开发者ID:visualturk,项目名称:pages-module,代码行数:21,代码来源:RenderNavigation.php


示例17: flushSectionsIfDoneRendering

 /**
  * Flush all of the section contents if done rendering.
  *
  * @return SectionsTrait
  */
 public function flushSectionsIfDoneRendering()
 {
     if ($this->viewFactory->doneRendering()) {
         $this->flushSections();
         return $this;
     }
 }
开发者ID:marianvlad,项目名称:blade-extensions,代码行数:12,代码来源:SectionsTrait.php


示例18: make

 /**
  * Make the view content.
  *
  * @param PageInterface $page
  */
 public function make(PageInterface $page)
 {
     $type = $page->getType();
     /* @var EditorFieldType $layout */
     $layout = $type->getFieldType('layout');
     $page->setContent($this->view->make($layout->getViewPath(), compact('page'))->render());
 }
开发者ID:visualturk,项目名称:pages-module,代码行数:12,代码来源:PageContent.php


示例19: getReset

 public function getReset($token = null)
 {
     if (is_null($token)) {
         $this->application->abort(404);
     }
     return $this->view->make('UserManagement::password.reset')->with('token', $token);
 }
开发者ID:PhonemeCms,项目名称:cms,代码行数:7,代码来源:RemindersController.php


示例20: anyUpload

 public function anyUpload(InterfaceFileStorage $userFileStorage, AmqpWrapper $amqpWrapper, Server $server, UploadEntity $uploadEntity)
 {
     /* @var \App\Components\UserFileStorage $userFileStorage */
     $responseVariables = ['uploadStatus' => false, 'storageErrors' => [], 'uploadEntities' => []];
     if ($this->request->isMethod('post') && $this->request->hasFile('file') && $this->request->file('file')->isValid()) {
         $tmpDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tmp-user-files-to-storage' . DIRECTORY_SEPARATOR;
         $tmpFilePath = $tmpDir . $this->request->file('file')->getClientOriginalName();
         $this->request->file('file')->move($tmpDir, $this->request->file('file')->getClientOriginalName());
         $userFileStorage->setValidationRules($this->config->get('storage.userfile.validation'));
         $newStorageFile = $userFileStorage->addFile($tmpFilePath);
         if ($newStorageFile && !$userFileStorage->hasErrors()) {
             /* @var \SplFileInfo $newStorageFile */
             // AMQP send $newfile, to servers
             foreach ($server->all() as $server) {
                 if (count($server->configs) > 0) {
                     foreach ($server->configs as $config) {
                         // Send server and file info to upload queue task
                         $amqpWrapper->sendMessage($this->config->get('amqp.queues.uploader.upload'), json_encode(['file' => $newStorageFile->getRealPath(), 'url' => $server->scheme . '://' . $config->auth . '@' . $server->host . '/' . trim($config->path, '\\/')]));
                     }
                 } else {
                     // The server has no configuration
                     $amqpWrapper->sendMessage($this->config->get('amqp.queues.uploader.upload'), json_encode(['file' => $newStorageFile->getRealPath(), 'url' => $server->scheme . '://' . $server->host]));
                 }
             }
             $responseVariables['uploadStatus'] = true;
         } else {
             $responseVariables['storageErrors'] = $userFileStorage->getErrors();
         }
         if ($this->request->ajax()) {
             return $this->response->json($responseVariables);
         }
     }
     $responseVariables['uploadEntities'] = $uploadEntity->limit(self::UPLOAD_ENTITIES_LIMIT)->orderBy('created_at', 'DESC')->get();
     return $this->view->make('upload.index', $responseVariables);
 }
开发者ID:ysaroka,项目名称:uploader,代码行数:35,代码来源:UploadController.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP View\View类代码示例发布时间:2022-05-23
下一篇:
PHP Validation\Validator类代码示例发布时间: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