Skip to content

Commit

Permalink
Merge pull request #24 from EgoistDeveloper/main
Browse files Browse the repository at this point in the history
Fix "Object of class Closure could not be converted to string" error
  • Loading branch information
Andrey Helldar authored Jul 28, 2022
2 parents 25b0239 + b0d2c77 commit a97d3e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Models/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ public function getMiddlewares(): array
$middlewares = array_merge($middlewares, $this->route->{$method}());
}

return array_values($middlewares);
return Arr::of($middlewares)
->map(fn (mixed $middleware) => is_callable($middleware) ? 'closure' : $middleware)
->values()
->toArray();
}

public function getSummary(): ?string
Expand Down

0 comments on commit a97d3e6

Please sign in to comment.