protected function getContent(Router $router, Context $context, Route $route) { $callback = $route->getAction(); $values = $router->extract($context, $route); $bindings = $router->bind($values, $route->getBindings()); $arguments = $router->buildArguments($callback, $bindings); return $callback(...$arguments); }
<?php /** * Bind the {id} variable to get posts of that ID */ Router::bind('id', function ($value) { return Post::make()->in($value)->get(); });