Friday, March 31, 2017

Binding routes to wrong method controller

I am using laravel 5.1 app. I have the bellow routes:

Route::get('{thing}', 'DisplayController@showThingNewRoute');
Route::get('{about}', 'DisplayController@showAboutNewRoute');

Also I use RouteServiceProvider like so:

    public function boot(Router $router)
    {

    parent::boot($router);

    $router->bind('thing', function($thing){ 
       return \App\Thing::publish()->where('seo_url', '=', $thing)->first(); 
   }); 

    $router->bind('about', function($about){ 
       return \App\About::publish()->where('seo_url', '=', $about)->firstOrFail(); 
    });    

    }

The problem is that I can't have a route to execute with a second method showAboutNewRoute

What am i doing wrong here?



via amrfs

Advertisement