- Installation
- Usage
- Get All Themes
- Set Active Theme
- Get Current Theme
- Check Theme
- Set Themes Path
- Get Themes Path
- Get Theme's Path
- Get Theme's View
- Get Theme's Lang
- Get Theme's Config
- Artisan Commands
- theme:make
- theme:list
- theme:cache
- theme:publish
Installation
Open your composer.json file, and add the new required package.
"pingpong/themes": "~2.1"
Next, open a terminal and run.
composer update
Next, Add new service provider in
config/app.php
.'Pingpong\Themes\ThemesServiceProvider',
Next, Add new aliases in
config/app.php
.'Theme' => 'Pingpong\Themes\ThemeFacade',
Next, publish the package's assets.
php artisan vendor:publish
Done.
Usage
Theme::all();
Theme::set('default');
Theme::setCurrent('default');
Theme::getCurrent();
Theme::has('simple')
Theme::exists('other-theme');
$path = public_path('themes');
Theme::setPath($path);
Theme::getThemePath('default');
Theme::getPath();
Theme::view('index');
Theme::view('folders.view');
Theme::lang('group.name');
Theme::config('filename.key');
Theme::config('filename.key.subkey');
Theme::config('filename.key.subkey', 'default value here');
If your theme's config file named
config.php
, you can get the value of config little bit short.Theme::config('key');
Theme::config('key.subkey');
You can also get config value from other theme.
// current theme
Theme::config('key');
// from other theme
Theme::config('bootstrap::key');
Artisan Commands
php artisan theme:make foo
php artisan theme:list
php artisan theme:cache
php artisan theme:publish
Publish all theme's assets from the specified theme.
php artisan theme:publish theme-name
Source:
Pingpong Labs
No comments:
Post a Comment