Package Data | |
---|---|
Maintainer Username: | codefromtony |
Maintainer Contact: | tony@codewithtony.com (Tony.) |
Package Create Date: | 2016-02-25 |
Package Last Update: | 2017-04-01 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-11 15:16:36 |
Package Statistics | |
---|---|
Total Downloads: | 3,150 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 11 |
Total Watchers: | 4 |
Total Forks: | 0 |
Total Open Issues: | 0 |
The simpliest of theme switching for Laravel 5
Install Laravel Theme manager:
composer require codewithtony/larathemes
At config/app.php
, add the Service Provider and the Facade:
'providers' => [
Tony\Themes\ThemeServiceProvider::class,
]
//...
'aliases' => [
'Theme' => Tony\Themes\Themes\ThemeFacade::class,
]
themes
├── [theme name]
| └── assets
| └── views
|
└── [theme name]
└── assets
└── views
Changing your theme is easy
Theme::set('my-theme')
Easily use the Middleware to change themes for an entire group
Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'theme:admin'], function () {
//...
});
Load your views like normal, Laravel Theme will look for your view in the set theme and if it isn't found, view finding will remain the same
You can reuse views by storing them outside of your theme and just uses view('layout.master') and have your layout/master.blade.php inside you themes.
Your assets will need to be sent to your public folder still.
Your help is more than welcome!
Licensed under the The MIT License (MIT). Please see LICENSE for more information.