katsucurry
katsucurry

Reputation: 79

Laravel 'Route Not Defined' when using two routes on the same /URL

In my web.php I have the following two routes

Route::post('/approvedesigns', 'DesignsController@uploadDesigns')->name('upload.designs');

Route::post('/approvedesigns', 'DesignsController@removeDesigns')->name('disapprove.designs');

When running php artisan route:list I get -

|        | GET|HEAD                               | approvedesigns        |                    | App\Http\Controllers\DesignsController@approveDesigns | web          |
|        | POST                                   | approvedesigns        | disapprove.designs | App\Http\Controllers\DesignsController@removeDesigns  | web          |

The name is not picked up on the first route.

If I remove the second route then the first route works okay again with no problems.

What am I doing wrong here?

Upvotes: 0

Views: 223

Answers (1)

Fahim Ahmed
Fahim Ahmed

Reputation: 139

Why you are using same url for them? Try using different url in stead of approvedesigns for both. As you are using "/approvedesigns" and their methods(Post) are also same that's why the problem is occuring. Did you try changing the route name? If you did let me know. You can also try resource controller too. By trying different url will fix your problem if still you are facing issue let me know.

Upvotes: 1

Related Questions