D
D
dimon1192016-02-26 20:56:34
Laravel
dimon119, 2016-02-26 20:56:34

How to make routing for two types of users in Laravel 5?

route.php

Route::get('user/login', '[email protected]')->name('login');
Route::group(['middleware' => ['acc']], function() {
  Route::get('/', '[email protected]')->name('main');
});
Route::group(['middleware' => ['wm']], function() {
  Route::get('wm', '[email protected]')->name('main');
});

The problem is that I write route('main') in the template and I get the /wm link, although I entered through the acc group, and if I go through wm, the /wm link is also displayed Tell me
how to organize routing for two types of users?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-02-26
@alexey-m-ukolov

Give them different names: main.acc/main.wm for example. The framework, on the other hand, cannot guess which address you want to receive if your routes have the same name - so it takes the last declared one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question