예제 #1
0
 /**
  * Displays the login form.
  */
 public function getLogin()
 {
     $viewConfig = $this->config->get('l4-lock::config.lock.views');
     if ($this->view->exists($viewConfig['foot-note'])) {
         $viewConfig['foot-note'] = $this->view->make($viewConfig['foot-note'])->render();
     }
     return $this->view->make($this->config->get('l4-lock::config.lock.views.login'), array('view' => $viewConfig))->render();
 }
 /**
  * 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();
 }
 /**
  * Handle incoming requests.
  * @param Request $request
  * @param \Closure $next
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle($request, Closure $next)
 {
     if ($this->maintenance->isDownMode()) {
         if ($this->view->exists('errors.503')) {
             return new Response($this->view->make('errors.503'), 503);
         }
         return $this->app->abort(503, 'The application is down for maintenance.');
     }
     return $next($request);
 }
예제 #4
0
 /**
  * @return mixed
  */
 private function renderContent()
 {
     if (!$this->view->exists($this->template)) {
         $this->getFallBackTemplate();
     }
     return $this->view->make($this->template, $this->data);
 }
예제 #5
0
 /**
  * Build the template of the control.
  * We check if the assets of the package where published in the views/vendor directory
  * Of the project, if they don not have published in their project's, we check if exists a custom
  * View for the type of control on the package views.
  * If does not exist the view for the control we return the default.
  *
  * @param $type
  * @param $attributes
  * @return string
  */
 public function buildTemplate($type, &$attributes)
 {
     // Path to vendor form builder views.
     $publishedPath = base_path() . '/resources/views/vendor/socieboy/forms/';
     // If the view was published on the project.
     if (File::exists($publishedPath . $type . '.blade.php')) {
         /**
          * If the attributes has a icon we are going to display the
          * view for group controls, other way we just return the custom view.
          */
         if (isset($attributes['icon'])) {
             unset($attributes['icon']);
             return $publishedPath . 'group.blade.php';
         }
         return $publishedPath . $type . '.blade.php';
     } else {
         if ($this->view->exists('FieldBuilder::' . $type)) {
             return 'FieldBuilder::' . $type;
         }
     }
     /**
      * If the attributes has an icon we return the view of the package for group controls.
      */
     if (isset($attributes['icon'])) {
         unset($attributes['icon']);
         return 'FieldBuilder::group';
     }
     /**
      * If the view is in the package and does not have icon we just return the custom view.
      */
     return 'FieldBuilder::default';
 }
예제 #6
0
 /**
  * Render widget to HTML.
  *
  * @throws UnknownWidgetFileException
  * @return string
  */
 public function render()
 {
     if ($this->enable == false) {
         return '';
     }
     $widgetDir = $this->config->get('theme.containerDir.widget');
     $path = $this->theme->getThemeNamespace($widgetDir . '.' . $this->template);
     // If not found in theme widgets directory, try to watch in views/widgets again.
     if ($this->watch === true and !$this->view->exists($path)) {
         $path = $widgetDir . '.' . $this->template;
     }
     // Error file not exists.
     if (!$this->view->exists($path)) {
         throw new UnknownWidgetFileException("Widget view [{$this->template}] not found.");
     }
     $widget = $this->view->make($path, $this->data)->render();
     return $widget;
 }
 private function getSections($parent)
 {
     $sections = [];
     if (!$this->view->exists($parent)) {
         $this->warn("Could not find view: {$parent}");
         return $sections;
     }
     $path = $this->view->getFinder()->find($parent);
     $content = $this->file->get($path);
     if (preg_match_all('/\\B@(\\w+)([ \\t]*)(\\( ( (?>[^()]+) | (?3) )* \\))?/x', $content, $matches)) {
         for ($i = 0; $i < count($matches[1]); $i++) {
             if ($matches[1][$i] == 'yield') {
                 $sections[] = $matches[4][$i];
             }
         }
     }
     return $sections;
 }
예제 #8
0
 /**
  * Return a template with content.
  *
  * @param  integer $statusCode
  * @throws UnknownLayoutFileException
  * @return Response
  */
 public function render($statusCode = 200)
 {
     // Fire the event before render.
     $this->fire('after', $this);
     // Flush asset that need to serve.
     $this->asset->flush();
     // Layout directory.
     $layoutDir = $this->getConfig('containerDir.layout');
     $path = $this->getThemeNamespace($layoutDir . '.' . $this->layout);
     if (!$this->view->exists($path)) {
         throw new UnknownLayoutFileException("Layout [{$this->layout}] not found.");
     }
     $content = $this->view->make($path)->render();
     // Append status code to view.
     $content = new Response($content, $statusCode);
     // Having cookie set.
     if ($this->cookie) {
         $content->withCookie($this->cookie);
     }
     return $content;
 }
예제 #9
0
 /**
  * Determine if a given view exists.
  *
  * @param string $view
  * @return bool 
  * @static 
  */
 public static function exists($view)
 {
     return \Illuminate\View\Factory::exists($view);
 }