Creating an entry
Capture your moments by creating new diary entries with text and optional image attachments.Access the create form
From your diary home page, click the “New Entry” or ”+” button to open the entry creation form.
Write your entry
Enter your diary text in the body field. This is required—every entry needs content.
Add an image (optional)
Upload an image to accompany your entry by clicking the file upload button. Supported formats include common image types (JPEG, PNG, etc.).
Set visibility
Choose who can see this entry:
- Private: Only you can see it
- Friends: Shared with selected friends
- Public: Visible to all (if applicable)
Share with friends (optional)
If you’re sharing with specific friends, select them from your friends list. You can choose multiple friends.
When you create an entry, it’s automatically associated with your account as the creator. The creation timestamp is recorded for chronological organization.
Entry structure
Each diary entry contains:- Body: The text content of your entry (required)
- Visibility: Privacy setting controlling access
- Creator: Your user account (automatically set)
- Image: Optional photo attachment
- Shared friends: List of friends who can view this entry (if visibility allows)
- Timestamps: Creation and last update times
Viewing entries
Your diary entries are displayed on your home page in chronological order.Entry display includes:
- Entry text content
- Attached image (if present)
- Creation date and time
- Visibility indicator
- Creator information
- Like count (from friends)
You can view entries you’ve created as well as entries shared with you by friends, depending on their visibility settings.
Updating an entry
You can edit your existing entries to update text, change images, or modify privacy settings.Update or remove image
You have three options:
- Keep existing image: Don’t change the file upload
- Replace image: Upload a new file (the old image is automatically deleted)
- Remove image: Clear the file field to delete the attached image
What happens when you update
- Text updates
- Image replacement
- Image removal
- Friend sharing updates
Changes to the body text are saved immediately. The entry’s
updated_at timestamp is refreshed.Deleting an entry
Permanently remove entries you no longer want to keep.Ownership protection
You can only delete entries that belong to you. The system verifies that you’re the creator before allowing deletion. If you try to delete someone else’s entry, you’ll receive a “not_your_entry” error.Entry permissions
MyDiary enforces strict ownership rules:Who can create entries?
Who can create entries?
Any authenticated user can create diary entries. Each entry is automatically linked to your account as the creator.
Who can view entries?
Who can view entries?
Entry visibility depends on the privacy setting:
- Your entries: You can always view all your own entries
- Shared entries: Friends can view entries explicitly shared with them
- Private entries: Only visible to the creator
Who can edit entries?
Who can edit entries?
Only the creator can edit their entries. The system checks your user ID against the entry’s
creator_id before allowing modifications.Who can delete entries?
Who can delete entries?
Only the creator can delete their entries. Deletion permission is verified server-side to prevent unauthorized removal.
Best practices
Tips for managing your diary:
- Use descriptive, meaningful content in your entries
- Review your visibility settings before saving
- Regularly back up important entries by exporting or saving elsewhere
- Use images to enhance your memories
- Update entries to correct typos or add details
- Clean up old entries you no longer need
Technical implementation details
Technical implementation details
Diary entry functionality is implemented in
EntryController.php with the following features:- Create:
create()method validates body text, saves entry with visibility and creator ID, handles optional file upload, and attaches selected friends - Update:
update()method verifies ownership, updates content and visibility, manages image replacement/removal with file system cleanup, and syncs friend sharing - Delete:
delete()method verifies ownership and cascades deletion to related records (images, shares, likes) - Authorization: All modification operations check that
Auth::user()->idmatchesentry->creator->id - File Storage: Images are stored in
storage/app/public/uploadswith original filenames preserved - Database Cascade: Foreign key constraints ensure related records are cleaned up on entry deletion