Здравствуйте пытаюсь создать кнопку "Delete", для удаление строки но выдаёт ошибку "
DELETE http://127.0.0.1:8000/api/anketa/1 405 (Method Not Allowed)?
".
Вот мой код:
DeleteController:
<?php
namespace App\Http\Controllers\Glavnoe_menu\Ispytatelnaya_laboratoriya;
use App\Http\Controllers\Controller;
use App\Models\Glavnoe_menu\Ispytatelnaya_laboratoriya\Anketa_organizatsii;
class DeleteController extends Controller
{
public function __invoke(Anketa_organizatsii $anketa)
{
$anketa -> delete();
return response([]);
}
}
api.php
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Route::group(['namespace' => 'Glavnoe_menu.Ispytatelnaya_laboratoriya.Anketa_organizatsii', 'prefix' => 'anketa'], function () {
Route::post('/', [Anketa_organizatsiiController::class, '__invoke']);
Route::get('/', [Anketa_organizatsiiSpisokController::class, '__invoke']);
Route::patch('/{anketa}', [UpdateController::class, '__invoke']);
Route::delete('/{anketa}', [DeleteController::class, '__invoke']);
});
Компонент
deleteStroka(id){
axios.delete(`/api/anketa/${id}`)
.then(res => {
this.getpoluhenie();
Кнопка
<td><a href="#" @click.prevent="deleteStroka(spisok.id)" class="btn btn-danger">Delete</a></td>