Hyzyr
Hyzyr

Reputation: 937

Route [people.comments] not defined

help me to find the problem, the laravel project gives error before loading

Route [people.comments] not defined

I copied and pasted the route name, copied and pasted the working routes, but no, it doesn't work.

    Route::post('/people/comments', 'Admin\PeopleController@comments')->name('people.comments');

And It worked when I changed method POST to GET Route::get('/people/comments', 'Admin\PeopleController@comments')->name('people.comments');

I am using this route inside a JAVASCRIPT

      let url = '{{ route("people.comments") }}';

Now the question is why it is worked when I changed post to get? and why it is not working in POST ? (I don't have routes with same name) THANKS

Upvotes: 0

Views: 230

Answers (1)

Hyzyr
Hyzyr

Reputation: 937

This was my error two posts with same address and same method

 Route::post('/people/comments', 'Admin\PeopleController@comments')->name('people.comments');
 Route::post('/people/comments', 'Admin\PeopleController@blogs')->name('people.blogs');

Upvotes: 0

Related Questions