PHP code example of bagosii / laravel-theme

1. Go to this page and download the library: Download bagosii/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/ */

    

bagosii / 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 /resources/views (or what ever is defined in )
    'views-path' 	=> 'path-to-views',

    // The path where the assets are stored
    // Defaults to 'theme-name' 
    // It is relative to /public
    'asset-path' 	=> 'path-to-assets',   // defaults to: theme-name

    // you can add your own custom keys and retreive them with Theme::config('key')
],

Theme::set('theme-name');    // switch to 'theme-name'
Theme::get();                // retreive current theme's name
Theme::config('key');        // read current theme's configuration value for 'key'

class themeSelectServiceProvider extends ServiceProvider {

    public function boot()
    {
        if (\Request::segment(1)=='admin')
            \Theme::set('adminTheme');
    }

}

Theme::url('path-to-file')

Theme::js('file-name')
Theme::css('file-name')
Theme::img('src','alt', 'class-name')