1. Go to this page and download the library: Download mauro-moreno/laravel-theme library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mauro-moreno / laravel-theme example snippets
// Select a name for your theme
'theme-name' => [
/*
|--------------------------------------------------------------------------
| Theme to extend. Defaults to null (=none)
|--------------------------------------------------------------------------
*/
'extends' => 'theme-to-extend',
/*
|--------------------------------------------------------------------------
| The path where the view are stored. Defaults to 'theme-name'
| It is relative to 'themes_path' ('/resources/views' by default)
|--------------------------------------------------------------------------
*/
'views-path' => 'path-to-views',
/*
|--------------------------------------------------------------------------
| The path where the assets are stored. Defaults to 'theme-name'
| It is relative to laravels public folder (/public)
|--------------------------------------------------------------------------
*/
'asset-path' => 'path-to-assets',
/*
|--------------------------------------------------------------------------
| Custom configuration. You can add your own custom keys.
| Retrieve these values with Theme::config('key'). e.g.:
|--------------------------------------------------------------------------
*/
'key' => 'value',
],
Theme::set('theme-name'); // switch to 'theme-name'
Theme::get(); // retrieve current theme's name
Theme::current(); // retrieve current theme's object
Theme::config('key'); // read current theme's configuration value for 'key'
Theme::configSet('key','value'); // assign a key-value pair to current theme's configuration
Route::group(['prefix' => 'admin', 'middleware'=>'SetTheme::ADMIN_THEME'], function() {
// ... Add your routes here
// The ADMIN_THEME will be applied.
});