简体   繁体   中英

Route-Model-Binding in Laravel 5 with annotation

i have read some articles about routing and annotions.

http://mattstauffer.co/blog/laravel-5.0-route-annotations

But since routes.php is removed in Laravel 5 and annotations became the favourite routing part. how can i bind a model to a route using annotation?

In Laravel 5, route model bindings are stored in the before method of the App\\Providers\\RouteServiceProvider class:

public function before(Router $router, UrlGenerator $url)
{
    $router->model('user', 'App\User');
}

This gets called before any of the routes are loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM