mercredi 7 décembre 2016

why should I refresh to work delete button in Laravel 5.2

I am using this delete button to delete task in table

 <button class="btn btn-danger delete pull-right"
                     data-action="/projects//tasks/"
                     data-token="">
                     <i class="fa fa-trash-o"></i>Delete
                    </button>

this is delete controller

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');
    }

and routes

Route::delete('projects/{projects}/tasks/{tasks}', [
    'uses' => '\App\Http\Controllers\ProjectTasksController@deleteOneProjectTask',
]);

but when I click delete button it is not delete task. but when I refresh it it will delete. how can fix this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire