is('admin', 'admin/*', 'stylist', 'stylist/*') ? 'backend' : 'frontend'; try { $theme = app(Stylist::class)->current($context); if ($theme->type() === $context) { $path = $theme->path().'/views'; if (is_dir($path)) { // Prepend so ordinary view('admin.index') and @extends('layouts.app') // resolve theme files first, then original application files. View::getFinder()->prependLocation($path); } } } catch (Throwable $exception) { report($exception); // Original application views remain available. } return $next($request); } }