Skip to content

Commit

Permalink
Fixed binging for Laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Jul 14, 2024
1 parent 5a8b079 commit 8b0ecfe
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Binding.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Support\Str;
use ReflectionClass;
use ReflectionParameter;
use Illuminate\Support\Facades\Route;

class Binding
{
Expand Down Expand Up @@ -91,7 +92,19 @@ public function bindResolve(string $procedure, Collection $params): array

return [$key => $value ?? $valueDot];
})
->map(fn ($value, string $key) => with($value, $this->binders[$key] ?? null))
->map(function ($value, string $key) {

$closure = $this->binders[$key] ?? null;

if (is_callable($closure)) {
return app()->call($closure, [
'value' => $value,
'route' => Route::current()
]);
}

return $value;
})
->filter()
->toArray();
}
Expand Down

0 comments on commit 8b0ecfe

Please sign in to comment.