lundi 28 octobre 2019

BadMethodCallException Method App\Http\Controllers\TaskController::destory does not exist

I'm using laravel 5.8 and this is my routes/api.php file.

Route::get('/tasks', 'TaskController@index')->name('tasks.index');
Route::post('/tasks', 'TaskController@store')->name('tasks.store');
Route::get('/tasks/{task}', 'TaskController@show')->name('tasks.show');
Route::put('/tasks/{task}', 'TaskController@update')->name('tasks.update');
Route::delete('/tasks/{task}', 'TaskController@destory')->name('tasks.destroy');

And this is function destroy() inside TaskController,

public function destroy(Task $task)
{
    $task->delete();

    return response()->json([
        'message' => 'Successfully deleted task!'
    ]);
}

But when I call the function I get this error,

BadMethodCallException Method App\Http\Controllers\TaskController::destory does not exist.

It would be really great if someone can help.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/368ZDui
via IFTTT

Aucun commentaire:

Enregistrer un commentaire