diff --git a/src/Views/ViewExceptionMapper.php b/src/Views/ViewExceptionMapper.php index a1bb748..3872776 100644 --- a/src/Views/ViewExceptionMapper.php +++ b/src/Views/ViewExceptionMapper.php @@ -83,10 +83,10 @@ protected function modifyViewsInTrace(IgnitionViewException $exception): void { $viewIndex = null; - $trace = Collection::make($exception->getPrevious()->getTrace()) ->map(function ($trace, $index) use (&$viewIndex) { if ($originalPath = $this->findCompiledView(Arr::get($trace, 'file', ''))) { + $trace['file'] = $originalPath; $trace['line'] = $this->getBladeLineNumber($trace['file'], $trace['line']); @@ -98,7 +98,7 @@ protected function modifyViewsInTrace(IgnitionViewException $exception): void return $trace; }) ->when( - $viewIndex !== null, + $viewIndex !== null && str_ends_with($exception->getFile(), '.blade.php'), fn (Collection $trace) => $trace->slice($viewIndex + 1) // Remove all traces before the view ) ->toArray();