Downloads
Stars
Version
This package supports the management view files and assets under separate folders in Laravel projects.
composer require mikelmi/mks-theme:dev-master
config/app.php
, to providers
: Mikelmi\MksTheme\Providers\MksThemeServiceProvider::class,
config/app.php
, to aliases
: 'Theme' => Mikelmi\MksTheme\Facades\Theme::class,
php artisan vendor:publish --provider="Mikelmi\MksTheme\Providers\MksThemeServiceProvider"
public/themes/
, for example public/themes/cool-theme
config/theme.php
: 'name' => 'cool-theme'
...
resources/views
within the folder public/themes/cool-theme/views
Theme::set('theme-name'); // switch to 'theme-name'
Theme::get(); // retrieve current theme's name
Theme::all(); // retrieve collection with all themes
Theme::asset('assets/path') // retrieve url to theme asset (e.g.: Theme::asset('assets/css/styles.css'))
Theme::info('key'/** or null */); // retrive theme info (from file /themes/theme-name/theme.php)