Downloads
Stars
Version
Laravel 主题模板功能, 这可能是我用过最优雅的laravel主题扩展
$ composer require hongyukeji/laravel-theme
$ php artisan vendor:publish --provider="Hongyukeji\LaravelTheme\ThemeServiceProvider"
利用 View::addNamespace() 和 View::prependNamespace() 实现主题模板功能
// 1. 在 config/themes.php 中 添加 templates, 如:
'templates' => [
'frontend' => [
'path' => 'frontend',
'template' => 'default',
'default' => 'default',
],
],
// 2. 在控制器中使用:
public function index()
{
return view('frontend::index.index');
}
// 3. 在视图目录新建frontend目录和对应的index(frontend => 终端, default => 主题):
resources/views/frontend
resources/views/frontend/default
resources/views/frontend/default/index
resources/views/frontend/default/index/index.blade.php
You can contribute in one of three ways:
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
MIT