Skip to content

Commit

Permalink
Handle case where an external call was made from a view
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Apr 30, 2024
1 parent 9a1b641 commit 166ad8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Views/ViewExceptionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand All @@ -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();
Expand Down

0 comments on commit 166ad8c

Please sign in to comment.