Edgy's avatar
Level 1

Conflicting of Route, how to fix this?

I have a conflicting route, how can I fix this? I figure out that these 2 routes conflict each other, the inbox.create is working properly, but the jobs.create have a problem, Route not defined. The jobs.create action from route:list is using WorkersTestController instead EmployersTestController. Is there any way to solve this conflicting routes?

Thanks.

// employer.php (this is route)
Route::prefix('/')->middleware('employer')->group(function () {
    Route::get   ('jobs/create','EmployersTestController@create')->name('jobs.create');
    Route::get   ('jobs/create','WorkersTestController@create')->name('inbox.create');

0 likes
3 replies
wilburpowery's avatar

What exactly are you trying to do? There is no need to prefix routes with /. Can you explain a little more?

Cronix's avatar
Cronix
Best Answer
Level 67

You can't have 2 identical endpoints (the url) responding to the same verb (get in this case). Simply change the endpoints so they are unique.

Route::get('jobs/employers/create', 'EmployersTestController@create')->name('jobs.create');
Route::get('jobs/workers/create', 'WorkersTestController@create')->name('inbox.create');
Edgy's avatar
Level 1

I cant believe on myself that I missed that typo. Thanks mate

Please or to participate in this conversation.