本文整理汇总了PHP中Illuminate\View\Factory::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::exists方法的具体用法?PHP Factory::exists怎么用?PHP Factory::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\Factory
的用法示例。
在下文中一共展示了Factory::exists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLogin
/**
* 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();
}
示例2: 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();
}
示例3: handle
/**
* 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: renderContent
/**
* @return mixed
*/
private function renderContent()
{
if (!$this->view->exists($this->template)) {
$this->getFallBackTemplate();
}
return $this->view->make($this->template, $this->data);
}
示例5: buildTemplate
/**
* 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: render
/**
* 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;
}
示例7: getSections
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: render
/**
* 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: exists
/**
* Determine if a given view exists.
*
* @param string $view
* @return bool
* @static
*/
public static function exists($view)
{
return \Illuminate\View\Factory::exists($view);
}