jeudi 20 octobre 2016

Laravel PHP function Route::resource to create non-english API

I have a web app dealing with contracts and clients essentially. I actually created my routes like following (do not be surprised if the routes are not in English, my application works with French records) :

Route::get('/client', 'ClientController@index');
Route::get('/client/{id}', 'ClientController@getById')->where('id', '[0-9]+');
Route::get('/client/{search}', 'ClientController@getByText')->where('search', '[a-z_.-\s]+');
Route::get('/client/creer'); // Form to create a new client
Route::post('/client/', 'ClientController@new');
// And so on ...

You will notice the comments, because there is so much routes that I just cannot put them all here. And that why I am wondering...

Question

Can I use this command instead :

Route::resource('client', 'ClientController');

But with non-english routes names ? Like instead of having client/create I would autmatically have client/creer ('creer' is the French traduction of 'create').



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire