Файл: vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php
Строк: 53
<?php
namespace IlluminateRoutingMiddleware;
use Closure;
use IlluminateContractsRoutingRegistrar;
use IlluminateDatabaseEloquentModelNotFoundException;
class SubstituteBindings
{
/**
* The router instance.
*
* @var IlluminateContractsRoutingRegistrar
*/
protected $router;
/**
* Create a new bindings substitutor.
*
* @param IlluminateContractsRoutingRegistrar $router
* @return void
*/
public function __construct(Registrar $router)
{
$this->router = $router;
}
/**
* Handle an incoming request.
*
* @param IlluminateHttpRequest $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
try {
$this->router->substituteBindings($route = $request->route());
$this->router->substituteImplicitBindings($route);
} catch (ModelNotFoundException $exception) {
if ($route->getMissing()) {
return $route->getMissing()($request, $exception);
}
throw $exception;
}
return $next($request);
}
}