1
votes

THIS IS MY VIEW CODE

<form method="POST" action="/update">
    Task Name:<input type="text" value="{{$task->TaskName}}" name="taskname"><br>
    Description:<input type="text" value="{{$task->Description}}" name="description"><br>
    Location id:<input type="text" value="{{$task->Location_id}}" name="location_id"><br>
    @if($task->status === 1)
    Status:<input type="checkbox" checked name="status"><br>
    @else
    Status:<input type="checkbox" name="status"><br>
    @endif
    Created at:<input type="" value="{{$task->created_at}}" name="created_at"><br>
    Modified at:<input type="date" value="{{$task->updated_at}}" name="modified_at"><br>
    <input type="submit" value="update" name="upadte" ><br>
    {{csrf_field()}}
</form>

THIS IS MY ROUTE CODE:

Route::get('/update', 'TasksController@update');

THIS IS MY CONTROLLER CODE FOR UPDATE:

public function update()
{
    dd("yoo");
    //return view('/update');
}
1
Change your Route to Route::post('/update', 'TasksController@update');Quynh Nguyen
thankyou it workedwahab memon

1 Answers

1
votes

Your form method is POST and your route is get.

Change your route to Route::post('update', 'TasksController@update');

For form method Get you have to use Route::get and for post you have to use Route::post.

Beside that you can assign a name to the route,

Route::post('update', 'TasksController@update')->name('TaskUpdate');.

Then in your form method use route(), Like method="{{route('TaskUpdate')}}", but your file extension should be .blade.php.