igaster / laravel-theme

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

Allowed to keep the view paths added at runtime after setting theme #141

Open videni opened 1 year ago

videni commented 1 year ago

https://github.com/igaster/laravel-theme/blob/b1efebe31ba39a1d3bea1709782be4a084dedd99/src/Themes.php#L76

May be we should use the config('view.paths'); to get views paths instead of setting it to the laravelViewsPath, so It's possible to get user's configured paths at runtime.

Add a view path before setting theme like following

        app('view.finder')->addLocation($sourcePath);

Then try to set current theme by

Themes::set('one_theme')

now the above path lost. instead of using the addLocation method, we can add new path to view.paths config ,

app('config')->push('view.paths', $sourcePath);

clearly say we want to keep the path like statically configured view paths after setting theme.