2
votes

It's not working showing this

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The POST method is not supported for this route. Supported methods: PUT, PATCH, DELETE.

<form class="form-ad" action="{{ route('jobs.store') }}" method="post" >
3
So allow POST or fake PUT/PATCH. - u_mulder
The error message literally tells you everything. You wrote method="post" and the error tells you that you can't use POST. It even tells you that you can either use PUT, PATCH or DELETE. - MechMK1

3 Answers

4
votes

Fake your patch request like this in form tag

<form class="form-ad" action="{{ route('jobs.store') }}" method="post" >
{{ method_field('POST') }} /*here i used post and solved the error*/ /*if you are using form method POST then what is the use of using {{method_field('POST')}} form "store" action? {{method_field('POST')}} is mainly used if you have a PATCH request for update action. Store action is already on POST request in your Routes.*/
<!-- rest of the form -->
</form>

Also, just a suggestions that you can simply make a resource full route.

First make a controller resourceful from artisan command, which will create all the methods required for each method (get, post, patch etc.)

php artisan make:controller Jobs -r

then in your routes/web.php use

Routes::resource('jobs');

You can also view your routes using php artisan command

php artisan route:list
0
votes

Available Router Methods The router allows you to register routes that respond to any HTTP verb:

Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);

https://laravel.com/docs/5.8/routing

0
votes

add @csrf line in the html view then it work post method

add @csrf line in the html view 
then it work post method
-------------------------------------------------------------------

<form  method="post" action="users" class="UserController">
    {{method_field('post')}}
    @csrf
    <input type="text" name="user" placeholder="enter name"><br/><br/>
    <input type="password" name="password" placeholder="enter password"><br/><br/>
    <button type="submit" value="submit">Submit</button>
</form>