Skip to content

Setting The Active Theme

Nguyễn Trần Chung edited this page Oct 7, 2018 · 6 revisions

Setting the active theme is incredibly easy. There are two methods that you can use, which will be covered below.

Using The Config File

You may define your default active theme through the provided config file. This is the easiest way if you don't plan on supporting many themes within your application.

config/themes.php

...

    'active' => 'foobar'

...

Setting During Run-Time

If you're building a larger application that may provide the means to dynamically change the theme, then you may do so through the use of the Theme::set() method. The most common place to put this call is from within a base Controller's __construct() method.

app/Http/Controllers/Controller.php

use Theme;

...

public function __construct()
{
    Theme::set('foobar');
}

...

Clone this wiki locally