handle not existing request
This commit is contained in:
parent
9190f2508e
commit
ea1b0af7b2
|
|
@ -20,13 +20,13 @@ class ThemeViewFinder extends FileViewFinder
|
|||
// Extract the $view and the $namespace parts
|
||||
list($namespace, $view) = $this->parseNamespaceSegments($name);
|
||||
|
||||
if (! Str::contains(request()->route()->uri, 'admin/')) {
|
||||
if (request()->route() !== null && ! Str::contains(request()->route()->uri, 'admin/')) {
|
||||
$paths = $this->addThemeNamespacePaths($namespace);
|
||||
|
||||
try {
|
||||
return $this->findInPaths($view, $paths);
|
||||
} catch(\Exception $e) {
|
||||
if ($namespace != 'shop') {
|
||||
if ($namespace !== 'shop') {
|
||||
if (strpos($view, 'shop.') !== false) {
|
||||
$view = str_replace('shop.', 'shop.' . Themes::current()->code . '.', $view);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ class Themes
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$routeURI = request()->route()->uri;
|
||||
|
||||
if (Str::contains(request()->route()->uri, 'admin/')) {
|
||||
if (request()->route() !== null && Str::contains(request()->route()->uri, 'admin/')) {
|
||||
$this->defaultThemeCode = Config::get('themes.admin-default', null);
|
||||
} else {
|
||||
$this->defaultThemeCode = Config::get('themes.default', null);
|
||||
|
|
@ -105,7 +103,7 @@ class Themes
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -117,8 +115,8 @@ class Themes
|
|||
public function loadThemes()
|
||||
{
|
||||
$parentThemes = [];
|
||||
|
||||
if (Str::contains(request()->route()->uri, 'admin/')) {
|
||||
|
||||
if (request()->route() !== null && Str::contains(request()->route()->uri, 'admin/')) {
|
||||
$themes = config('themes.admin-themes', []);
|
||||
} else {
|
||||
$themes = config('themes.themes', []);
|
||||
|
|
|
|||
Loading…
Reference in New Issue