Delete entry
Deletes an existing diary entry. Only the creator of the entry can perform deletion. This operation will cascade delete associated records.Endpoint
Authentication
This endpoint requires authentication via theauth middleware. Additionally, the authenticated user must be the creator of the entry to perform deletion.
Path parameters
The ID of the entry to delete. Laravel route model binding automatically resolves this to an Entry instance.
Authorization
The endpoint verifies that the authenticated user is the creator of the entry:not_your_entry error message and the deletion is prevented.
Response
On successful deletion, the user is redirected back with a confirmation message.Returns
delete_entry on successful entry deletion.Example request
Cascade deletion
When an entry is deleted, the following associated records are also removed:- Image attachments: Any
ImageEntryrecords associated with the entry - Friend associations: Entries in the
entry_userspivot table - Likes: Any
Likerecords associated with the entry
Error handling
If the authenticated user attempts to delete an entry they did not create, the request is rejected with thenot_your_entry message, and the user is redirected back to the previous page.