我正在使用此删除按钮删除表格中的任务
<button class="btn btn-danger delete pull-right"
data-action="/projects/{{ $project->id }}/tasks/{{ $task->id }}"
data-token="{{csrf_token()}}">
<i class="fa fa-trash-o"></i>Delete
</button>
这是删除控制器
public function deleteOneProjectTask($projectId, $taskId)
{
DB::table('tasks')
->where('project_id', $projectId)
->where('id', $taskId)
->delete();
return redirect()->route('projects.show')->with('info', 'Task deleted successfully');
}
和路线
Route::delete('projects/{projects}/tasks/{tasks}', [
'uses' => '\App\Http\Controllers\ProjectTasksController@deleteOneProjectTask',
]);
但是当我点击删除按钮时,它不是删除任务。但是当我刷新它会删除。怎么解决这个问题?