0

I have a controller That have multiple functions with the same router so I am getting error exception. Please Guide me for This error

Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'admin']], function()
{
    Route::get('/dashboard','DashboardController@chart');
    Route::get('/dashboard','DashboardController@index');
});
2
  • 2
    You can't call multiple different methods for one single route Commented Aug 17, 2017 at 13:30
  • What are you expecting it to do? Commented Aug 17, 2017 at 14:16

1 Answer 1

1

You can't, the solution is :

Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'admin']], function()
{
    Route::get('/chart','DashboardController@chart');
    Route::get('/dashboard','DashboardController@index');
});

Or you can call multiple functions on the same url, one with "get" method, and an other with "post" for example :

Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'admin']], function()
{
    Route::post('/dashboard','DashboardController@chart');
    Route::get('/dashboard','DashboardController@index');
});

But the Route::post() is accessible only after a form submission with method post.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your suggestions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.