1

I'm getting this error after posting the data.

Route;

Route::post('/classified/location', 'ClassifiedController@locationPost')->name('location-post');

Form;

<form class="form" method="post" action="/classified/location">
@csrf

enter image description here

4
  • Have you cleared your route cachce yet? Like php artisan route:clear? Commented Dec 18, 2018 at 12:41
  • have you declare csrf token? like {{ csrf_fields() }} in your view file. Commented Dec 18, 2018 at 12:58
  • <form class="form" method="post" action="/classified/location"> @csrf Commented Dec 18, 2018 at 13:01
  • yes i have run the artisan command Commented Dec 18, 2018 at 13:01

2 Answers 2

1

Please check your route file to make sure that you haven't defined the same route twice, in that case later will replace the prior so make sure route definition is unique and exactly once.

Also if you anyway are naming your routes then use the name itself to target it so use:

<form class="form" method="post" action="{{ route('location-post') }}">

Also, make sure you don't define two or more routes with the same name.

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

2 Comments

There is only one route with the same name.
What do you mean the same name? You have more one routes with the name "location-post"?
0

Your form tag like that:

<form class="form" method="post" action="{{route('location-post')}}">

OR

<form class="form" method="post" action="{{url('/classified/location')}}">

3 Comments

@bhdrnzl: If my answer work for you then please accept my answer
@bhdrnzl: You have two same route name ? (i.e location-post)
no not.. I have already added a picture, there is no other route with the same name that will collide with that name.

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.