Skip to content

Commit

Permalink
Add exception as parameter to the missing() callbacks (#38289)
Browse files Browse the repository at this point in the history
* Add ModelNotFoundException as input to missing closure

Add  `ModelNotFoundException` exception to the missing callback and only return the result of the callback if this is not present.

* Rename variable to $callbackResponse

* StyleCI fix

* Update SubstituteBindings.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
bilfeldt and taylorotwell committed Aug 9, 2021
1 parent ec9189e commit 744ce4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/Middleware/SubstituteBindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle($request, Closure $next)
$this->router->substituteImplicitBindings($route);
} catch (ModelNotFoundException $exception) {
if ($route->getMissing()) {
return $route->getMissing()($request);
return $route->getMissing()($request, $exception);
}

throw $exception;
Expand Down

0 comments on commit 744ce4c

Please sign in to comment.