diff --git a/src/Context/LaravelRequestContext.php b/src/Context/LaravelRequestContext.php index 69f5b3c7..74be8bdd 100644 --- a/src/Context/LaravelRequestContext.php +++ b/src/Context/LaravelRequestContext.php @@ -63,7 +63,7 @@ protected function getRouteParameters(): array ->map(function ($parameter) { return $parameter instanceof Model ? $parameter->withoutRelations() : $parameter; }) - ->map(function ($parameter){ + ->map(function ($parameter) { return method_exists($parameter, 'toFlare') ? $parameter->toFlare() : $parameter; }) ->toArray(); diff --git a/tests/Context/LaravelRequestContextTest.php b/tests/Context/LaravelRequestContextTest.php index 198f4a58..c2cd0ac8 100644 --- a/tests/Context/LaravelRequestContextTest.php +++ b/tests/Context/LaravelRequestContextTest.php @@ -84,14 +84,14 @@ public function it_will_call_the_to_flare_method_on_route_parameters_when_it_exi $route->bind($request); $request->setRouteResolver(function () use ($route) { - $route->setParameter('user', new class{ + $route->setParameter('user', new class () { public function toFlare(): array { return ['stripped']; } }); - return $route; + return $route; }); $context = new LaravelRequestContext($request);