jeudi 2 novembre 2017

switch route in web.php laravel

I've 2 routes in my web.php

1) Route::get('/{url}', 'MenuController@menu');

which provide url :

  • /menu

2) Route::get('/{name}', 'HomeSlideviewController@index')->name('promotiondetail');

which provide url :

  • /menu (different page but same name in route 1)
  • /food

I want to use 2 route if route = same name I want to use route 1 if route 1 dont have url It will use route 2 . In web.php is their anyway to do something like

if(Route::get('/{url}', 'MenuController@menu')) is null use

`Route::get('/{name}', 'HomeSlideviewController@index')->name('promotiondetail');`

now in my web.php I do this

 Route::get('/{url}', 'MenuController@menu');
 Route::get('/{name}', 'HomeSlideviewController@index')->name('promotiondetail');

when I go /food It will go page not found.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2h52Vdw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire