Reputation: 167
I was trying to use:
Route::resource('categoria','CategoriaController');
And when I look in the controller the model 'Categoria' don't in. Then I look into:
php artisan route:list
And I see below routes:
POST | categoria | categoria.store | Redebar\Http\Controllers\CategoriaController@store| web
GET|HEAD | categoria/create | categoria.create | Redebar\Http\Controllers\CategoriaController@create | web |
DELETE | categoria/{categorium} | categoria.destroy | Redebar\Http\Controllers\CategoriaController@destroy | web |
PUT|PATCH | categoria/{categorium} | categoria.update | Redebar\Http\Controllers\CategoriaController@update | web |
GET|HEAD | categoria/{categorium} | categoria.show | Redebar\Http\Controllers\CategoriaController@show | web |
GET|HEAD | categoria/{categorium}/edit | categoria.edit | Redebar\Http\Controllers\CategoriaController@edit | web
--->"categoria/{categorium}"<-----
So I did some tests, and I have discovered that the string "ia" turn into "ium". Example if I write :
galeria
laravel turn it in :
galeria/{galerium}
Why this happen, how can I fix this ?
Upvotes: 2
Views: 893
Reputation:
Here's what you need for localization:
// within AppServiceProvider's boot method
Route::resourceVerbs([
'create' => 'crear',
'edit' => 'editar',
]);
// register a resource
Route::resource('fotos', 'PhotoController')
// and the output
/fotos/crear
/fotos/{foto}/editar
https://laravel.com/docs/5.5/controllers#restful-localizing-resource-uris
Additionally you can explicitly name route parameters when using resource routes.
Route::resource('user', 'AdminUserController', ['parameters' => [
'user' => 'admin_user'
]]);
https://laravel.com/docs/5.5/controllers#restful-naming-resource-route-parameters
Upvotes: 1