Skip to content

Commit c2e2419

Browse files
committed
refactor: set view
1 parent 83eeb95 commit c2e2419

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

app/Exceptions/ErrorException.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,28 @@
99
namespace Fresns\WebsiteEngine\Exceptions;
1010

1111
use Illuminate\Support\Facades\Response;
12+
use Illuminate\Support\Facades\View;
1213

1314
class ErrorException extends \Exception
1415
{
1516
public function render()
1617
{
1718
// dd($this->getCode(), $this->getMessage());
1819

20+
// set view
21+
$themeFskey = fs_theme('fskey');
22+
if ($themeFskey) {
23+
View::addLocation(base_path("themes/{$themeFskey}"));
24+
25+
$currentPaths = View::getFinder()->getPaths();
26+
27+
$currentPaths = array_unique($currentPaths);
28+
29+
array_unshift($currentPaths, base_path("themes/{$themeFskey}"));
30+
31+
View::getFinder()->setPaths($currentPaths);
32+
}
33+
1934
if (\request()->wantsJson()) {
2035
return \response()->json([
2136
'code' => $this->getCode(),

app/Http/Middleware/WebConfiguration.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,18 @@ public function handle(Request $request, Closure $next)
8989
}
9090

9191
// set view
92-
View::addLocation(base_path("themes/{$themeFskey}"));
92+
$themeFskey = fs_theme('fskey');
93+
if ($themeFskey) {
94+
View::addLocation(base_path("themes/{$themeFskey}"));
95+
96+
$currentPaths = View::getFinder()->getPaths();
97+
98+
$currentPaths = array_unique($currentPaths);
99+
100+
array_unshift($currentPaths, base_path("themes/{$themeFskey}"));
101+
102+
View::getFinder()->setPaths($currentPaths);
103+
}
93104

94105
// set headers
95106
if (is_local_api()) {

0 commit comments

Comments
 (0)