igaster / laravel-theme

Theme support for Laravel
MIT License
516 stars 110 forks source link

Set theme in controller not work #100

Closed macagoraga closed 4 years ago

macagoraga commented 5 years ago

If I try to set theme in controller then it not work.

public function __construct()
{
    \Theme::set('custom');
    dd(\Theme::current()); // Return correctly custom theme info but load default
}

If I setup via config globally then work fine

macagoraga commented 5 years ago

I found here similar issue: https://github.com/igaster/laravel-theme/issues/87

I see you do a push here for fix this: https://github.com/igaster/laravel-theme/commit/31cab14baf75c6f38b5e1df5a4937885728c70a2

Version that I use don't have this push, I am using

igaster/laravel-theme v2.0.9

which should be last

macagoraga commented 5 years ago

Adding $themeViewFinder->flushFinderCache(); like in your push, get blank page.. themeViewFinder not found,

igaster commented 5 years ago

@macagoraga I don't think these two issues are related... Maybe the problem is that you are setting the theme in the constructor... and then some other code will change it to default...

If you try to set it in your controller method, will it fail again??