php - Laravel: translate resource URLs -
when resource controller created in laravel this:
class="lang-php prettyprint-override">route::resource('foo', 'foocontroller');
we urls like:
foo/create foo/store foo/{id}/edit foo/{id}/update ...i translate of these routes like:
foo/nouveau foo/store foo/{id}/modifier foo/{id}/updatethis code working:
class="lang-php prettyprint-override">route::resource('foo', 'foocontroller', array( 'names' => array( 'create' => 'nouveau', 'edit' => 'modifier', ... ) ));
the problem here edit
route: don't know how create works {id}
foo/{id}/modifier
.
as far know it's not possible using resource
method. need create routes manually using trans / lang::get
, example:
route::get('foo/{id}/'.trans('routes.edit'), 'foocontroller@edit');
the names can pass here in 3rd parameters named routes , don't have in mutual urls, if used named routes showed can use:
url::route('nouveau', 1);
and generate foo/1/edit
url. if didn't utilize here names should utilize then:
url::route('foo.edit',1);
to create url it's difference, no url impact here.
php laravel routes crud
No comments:
Post a Comment