本文整理汇总了PHP中Illuminate\Support\Facades\View::addLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP View::addLocation方法的具体用法?PHP View::addLocation怎么用?PHP View::addLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\View
的用法示例。
在下文中一共展示了View::addLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Alias the services in the boot.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/PublishedAssets/Views/themes' => base_path('resources/themes'), __DIR__ . '/PublishedAssets/Controllers' => app_path('Http/Controllers/Quarx'), __DIR__ . '/Migrations' => base_path('database/migrations'), __DIR__ . '/PublishedAssets/Middleware' => app_path('Http/Middleware'), __DIR__ . '/PublishedAssets/Routes' => base_path('routes'), __DIR__ . '/PublishedAssets/Config' => base_path('config')]);
$theme = Config::get('quarx.frontend-theme', 'default');
$this->loadViewsFrom(__DIR__ . '/Views', 'quarx');
View::addLocation(base_path('resources/themes/' . $theme));
View::addNamespace('quarx-frontend', base_path('resources/themes/' . $theme));
/*
|--------------------------------------------------------------------------
| Blade Directives
|--------------------------------------------------------------------------
*/
Blade::directive('theme', function ($expression) {
if (Str::startsWith($expression, '(')) {
$expression = substr($expression, 1, -1);
}
$theme = Config::get('quarx.frontend-theme');
$view = '"quarx-frontend::' . str_replace('"', '', str_replace("'", '', $expression)) . '"';
return "<?php echo \$__env->make({$view}, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>";
});
Blade::directive('menu', function ($expression) {
return "<?php echo Quarx::menu({$expression}); ?>";
});
Blade::directive('widget', function ($expression) {
return "<?php echo Quarx::widget({$expression}); ?>";
});
Blade::directive('images', function ($expression) {
return "<?php echo Quarx::images({$expression}); ?>";
});
Blade::directive('edit', function ($expression) {
return "<?php echo Quarx::editBtn({$expression}); ?>";
});
Blade::directive('markdown', function ($expression) {
return "<?php echo Markdown::convertToHtml({$expression}); ?>";
});
}
示例2: registerViewPath
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function registerViewPath()
{
View::addLocation(__DIR__ . "/views");
}