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