Consider this routes.php
file:
Router::model('bar', 'App\Bar');
Route::resource('foo', 'AnyController')
Which will generate the following routes:
GET foo
GET foo/create
POST foo
GET foo/{foo}
GET foo/{foo}/edit
PUT foo/{foo}
PATCH foo/{foo}
DELETE foo/{foo}
I need to bind a different model in routes. How to get it to produce the following urls instead?
GET foo
GET foo/create
POST foo
GET foo/{bar}
GET foo/{bar}/edit
PUT foo/{bar}
PATCH foo/{bar}
DELETE foo/{bar}
You can't change the generated routes when using resource, since the idea is to save the work of defining them manually, however if you want you can define them by declaring the custom routes you want before your call to Route::resource; otherwise, the routes defined by the resource method may unintentionally take precedence over your supplemental routes