W3cubDocs

/Laravel 8

RouteBinding

class RouteBinding (View source)

Methods

static Closure forCallback(Container $container, Closure|string $binder)

Create a Route model binding for a given callback.

static Closure createClassBinding(Container $container, string $binding)

Create a class based binding using the IoC container.

static Closure forModel(Container $container, string $class, Closure|null $callback = null)

Create a Route model binding for a model.

Details

static Closure forCallback(Container $container, Closure|string $binder)

Create a Route model binding for a given callback.

Parameters

Container $container
Closure|string $binder

Return Value

Closure

static protected Closure createClassBinding(Container $container, string $binding)

Create a class based binding using the IoC container.

Parameters

Container $container
string $binding

Return Value

Closure

static Closure forModel(Container $container, string $class, Closure|null $callback = null)

Create a Route model binding for a model.

Parameters

Container $container
string $class
Closure|null $callback

Return Value

Closure

Exceptions

ModelNotFoundException

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Routing/RouteBinding.html