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


PHP Factory::exists方法代码示例

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


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

示例1: handle

 public function handle(CheckPageExistsCommand $command)
 {
     $page = $this->pageFactory->create($command->getUri(), $command->getNamespace());
     if (!($exist = $this->view->exists($page->getPath()))) {
         $exist = $this->view->exists($page->getIndexPath());
     }
     return $exist;
 }
开发者ID:hscale,项目名称:fizl-pages,代码行数:8,代码来源:CheckPageExistsCommandHandler.php

示例2: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Exception               $e
  *
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof HttpException) {
         if ($this->view->exists('errors.' . $e->getStatusCode())) {
             return $this->view->make('errors.' . $e->getStatusCode(), ['request' => $request, 'exception' => $e]);
         }
     }
     return parent::render($request, $e);
 }
开发者ID:systemovich,项目名称:laraveldoctrine.org,代码行数:17,代码来源:Handler.php

示例3: handle

 /**
  * Handle the command.
  *
  * @param Factory $view
  * @return string
  */
 public function handle(Factory $view)
 {
     if ($view->exists($this->layout)) {
         return $this->layout;
     }
     if ($view->exists($layout = "theme::layouts/{$this->layout}")) {
         return $layout;
     }
     return "theme::layouts/{$this->default}";
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:16,代码来源:GetLayoutName.php

示例4: render

 /**
  * Renders a custom template or one of the default templates.
  *
  * The default template could be published (into resources/views/themes/)
  * or be located inside the components directory (vendor/styde/html/themes/)
  *
  * @param string $custom
  * @param array $data
  * @param null $template
  * @return string
  */
 public function render($custom, $data = array(), $template = null)
 {
     if ($custom != null) {
         return $this->view->make($custom, $data)->render();
     }
     $template = $this->theme . '/' . $template;
     if ($this->view->exists("themes/{$template}")) {
         return $this->view->make("themes/{$template}", $data)->render();
     }
     return $this->view->make('styde.html::' . $template, $data)->render();
 }
开发者ID:ramono,项目名称:html,代码行数:22,代码来源:Theme.php

示例5: compileCallback

 /**
  * Compile DataTable callback value.
  *
  * @param mixed $callback
  * @return mixed|string
  */
 private function compileCallback($callback)
 {
     if (is_callable($callback)) {
         return value($callback);
     } elseif ($this->view->exists($callback)) {
         return $this->view->make($callback)->render();
     }
     return $callback;
 }
开发者ID:rikardote,项目名称:agenda,代码行数:15,代码来源:Builder.php

示例6: renderHttpException

 /**
  * @param \Symfony\Component\HttpKernel\Exception\HttpException $exception
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $exception)
 {
     $status = $exception->getStatusCode();
     if ($this->view->exists("error::{$status}") && !$this->configuration->get('app.debug')) {
         return $this->response->view("error::{$status}", ['exception' => $exception], $status, $exception->getHeaders());
     } else {
         return $this->convertExceptionToResponse($exception);
     }
 }
开发者ID:notadd,项目名称:framework,代码行数:14,代码来源:Handler.php

示例7: handle

 /**
  * @param LoadPageViewCommand $command
  * @return  View
  */
 public function handle(LoadPageViewCommand $command)
 {
     $page = $command->getPage();
     // Make sure we create the view once
     if (!$page->getView()) {
         try {
             // Attempt to make default view
             $page->setView($this->factory->make($page->getPath()));
         } catch (\InvalidArgumentException $e) {
             // If not, try it as a index within the folder
             if ($this->factory->exists($page->getIndexPath())) {
                 $this->execute(new LoadPageViewIndexCommand($page));
             } else {
                 $this->execute(new LoadPageView404Command($page));
             }
         }
         $page->raise(new PageViewLoaded($page));
     }
     return $page;
 }
开发者ID:hscale,项目名称:fizl-pages,代码行数:24,代码来源:LoadPageViewCommandHandler.php

示例8: array

 function it_renders_default_templates(Factory $factory, View $view)
 {
     // Having
     $custom = null;
     $data = array();
     $template = 'theme/template';
     // Expect
     $factory->make(null, $data)->shouldNotBeCalled();
     $factory->exists("themes/theme/{$template}")->shouldBeCalled()->willReturn(false);
     $factory->make("themes/theme/{$template}", [])->shouldNotBeCalled();
     $factory->make("styde.html::theme/{$template}", [])->shouldBeCalled()->willReturn($view);
     $view->render()->shouldBeCalled()->willReturn('<html>');
     // When
     $this->render($custom, $data, $template)->shouldReturn('<html>');
 }
开发者ID:mcarral,项目名称:html,代码行数:15,代码来源:ThemeSpec.php

示例9: getOverloadPath

 /**
  * Get the override view path.
  *
  * @param  $view
  * @return null|string
  */
 public function getOverloadPath(View $view)
 {
     /**
      * We can only overload namespaced
      * views right now.
      */
     if (!str_contains($view->getName(), '::')) {
         return null;
     }
     /**
      * Split the view into it's
      * namespace and path.
      */
     list($namespace, $path) = explode('::', $view->getName());
     $path = str_replace('.', '/', $path);
     /**
      * If the module is shorthand
      * then check to see if we have
      * an active module to use for it.
      */
     if ($namespace === 'module' && $this->module) {
         $namespace = $this->module->getNamespace();
     }
     /**
      * If the view is already in
      * the theme then skip it.
      */
     if ($namespace == 'theme' || str_is('*.theme.*', $namespace)) {
         return null;
     }
     /**
      * If the view is a streams view then
      * it's real easy to guess what the
      * override path should be.
      */
     if ($namespace == 'streams') {
         $path = $this->theme->getNamespace('streams/' . $path);
     }
     /**
      * If the view uses a dot syntax namespace then
      * transform it all into the override view path.
      */
     if ($addon = $this->addons->get($namespace)) {
         $path = $this->theme->getNamespace("addons/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
     }
     if ($this->view->exists($path)) {
         return $path;
     }
     /**
      * If the view uses a dot syntax namespace then
      * transform it all into the override view path.
      *
      * @deprecated since v3.0.0
      */
     if ($addon) {
         $path = $this->theme->getNamespace("addon/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
     }
     if ($this->view->exists($path)) {
         return $path;
     }
     return null;
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:68,代码来源:ViewComposer.php

示例10: staticViewExists

 /**
  * @param string $name
  *
  * @return bool
  */
 private function staticViewExists(string $name) : bool
 {
     return $this->viewFactory->exists($this->staticViewName($name));
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:9,代码来源:StaticController.php

示例11: canDisplay

 /**
  * Can we display the exception?
  *
  * @param \Exception $original
  * @param \Exception $transformed
  * @param int        $code
  *
  * @return bool
  */
 public function canDisplay(Exception $original, Exception $transformed, $code)
 {
     return $this->factory->exists("errors.{$code}");
 }
开发者ID:henryngoo,项目名称:Laravel-Exceptions,代码行数:13,代码来源:ViewDisplayer.php


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