Theme finder issue fixed (Shop changes was reflecting in admin)

This commit is contained in:
jitendra 2019-04-09 15:22:45 +05:30
parent 4840b0361b
commit 6b247993e4
3 changed files with 14 additions and 12 deletions

View File

@ -15,13 +15,17 @@ class Theme
*/
public function handle($request, Closure $next)
{
$theme = app('themes');
$themes = app('themes');
$channel = core()->getCurrentChannel();
if ($channel && $channelThemeCode = $channel->theme) {
if ($theme->exists($channelThemeCode)) {
$theme->set($channelThemeCode);
if ($themes->exists($channelThemeCode)) {
$themes->set($channelThemeCode);
} else {
$themes->set(config('themes.default'));
}
} else {
$themes->set(config('themes.default'));
}
return $next($request);

View File

@ -53,12 +53,6 @@ class ShopServiceProvider extends ServiceProvider
*/
public function register()
{
$themes = $this->app->make('themes');
if (! $themes->current() && \Config::get('themes.default')) {
$themes->set(\Config::get('themes.default'));
}
$this->registerConfig();
}

View File

@ -19,10 +19,14 @@ class ThemeViewFinder extends FileViewFinder
// Extract the $view and the $namespace parts
list($namespace, $view) = $this->parseNamespaceSegments($name);
$paths = $this->addThemeNamespacePaths($namespace);
if ($namespace != 'admin') {
$paths = $this->addThemeNamespacePaths($namespace);
// Find and return the view
return $this->findInPaths($view, $paths);
// Find and return the view
return $this->findInPaths($view, $paths);
} else {
return $this->findInPaths($view, $this->hints[$namespace]);
}
}
public function addThemeNamespacePaths($namespace)