2017-03-19 2 views
1

THIS IS MY VIEW CODEMethodNotAllowedHttpException in RouteCollection.php Linie 233:

<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> 

DIES IST MEIN WEG-Code ist:

Route::get('/update', '[email protected]'); 

THIS IS MY Steuerungskode FOR UPDATE:

public function update() 
{ 
    dd("yoo"); 
    //return view('/update'); 
} 
+2

Ändern Sie Ihre Route zu 'Route :: post ('/ update', 'TasksController @ update');' –

+0

danke, es hat funktioniert –

Antwort

1

Ihre Formularmethode ist POST und Ihre Route lautet get.

Ihre Route ändern zu Route::post('update', '[email protected]');

Für Formularmethode Get Sie Route::get verwenden müssen und für post haben Sie Route::post zu verwenden.

Neben, dass Sie einen Namen für die Route zuordnen können,

Route::post('update', '[email protected]')->name('TaskUpdate');.

Dann in Ihrer Form Methode route(), wie method="{{route('TaskUpdate')}}", aber Ihre Dateierweiterung sollte .blade.php sein.

+0

Danke, Sir, es hat funktioniert. –

Verwandte Themen