Answer the question
In order to leave comments, you need to log in
What is the best way to implement Laravel and Vue Router routes?
Conditionally on Laravel, I write the path to the Vue application:
Route::group(['prefix' => 'users', 'middleware' => ['permission:users read']], function (){
Route::get('/', '[email protected]');
Route::get('create', '[email protected]');
Route::get('edit/{id}', '[email protected]');
Route::get('detail/{id}', '[email protected]');
});
path: 'users',
component: UsersComponent,
meta: {
breadcrumb: 'Пользователи',
},
children: [
{
path: '/',
name: 'users.index',
component: UsersIndex,
meta: {
breadcrumb: 'Все',
},
},
{
path: 'create',
name: 'users.create',
component: UserCreate,
meta: {
breadcrumb: 'Создать пользователя',
},
},
{
path: 'detail/:id',
name: 'users.detail',
component: UserDetail,
meta: {
breadcrumb: 'Детальная информация о пользователе',
},
},
{
path: 'edit/:id',
name: 'users.edit',
component: UserEdit,
meta: {
breadcrumb: 'Изменить пользователя',
},
},
]
Route::get('detail/{id}', '[email protected]');
?
Answer the question
In order to leave comments, you need to log in
Send all requests to one controller
Clearly, in this case, you will not get 404 responses for any requests.
Route::fallback('[email protected]');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question