Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/estebansalas94/Prueba-Soporte/llms.txt

Use this file to discover all available pages before exploring further.

This endpoint requires an active authenticated session. Unauthenticated requests are redirected to the login page.

Endpoint

DELETE /tasks/{id}

Description

Permanently removes a task record from the database using findOrFail. If the task does not exist, Laravel returns a 404 response automatically.
Deletion is permanent and cannot be undone. There is no soft-delete or archive mechanism. Once deleted, the task record is gone from the database.

Path parameters

id
integer
required
The unique identifier of the task to delete.

Response

Returns a JSON object confirming deletion.

Response fields

message
string
A confirmation string. Value: "Task deleted successfully"

Example response

{
  "message": "Task deleted successfully"
}
HTTP status: 200

Error response

If no task with the given id exists, Laravel’s findOrFail throws a ModelNotFoundException and returns:
{
  "message": "No query results for model [App\\Models\\Task] {id}."
}
HTTP status: 404

Controller code

// app/Http/Controllers/TaskController.php

// Eliminar tarea
public function destroy($id)
{
    $task = Task::findOrFail($id);
    $task->delete();

    return response()->json(['message' => 'Task deleted successfully'], 200);
}

Frontend Axios call

// resources/js/store.js — deleteTask action

deleteTask({ commit }, taskId) {
    axios.delete(`/tasks/${taskId}`)
        .then(() => {
            commit('DELETE_TASK', taskId);
        })
        .catch(error => {
            console.error("Error deleting task:", error);
        });
},

Build docs developers (and LLMs) love