Build the show/detail page for a single maintenance log
Concept
When a technician needs to examine one specific maintenance log entry closely, they pull it from the records room. The show page does this digitally: it displays all the details of one single maintenance log entry. The show() method in your controller finds the specific entry by its ID and passes it to the view.
Apply
Write the show() method in your controller and create the show.blade.php view to display all fields of one maintenance log entry.
Prompt
Expected Result
The show() method uses findOrFail() to retrieve one log by ID. The show.blade.php view displays all fields of that log entry with "Back to List" and "Edit" links. Visit http://localhost:8000/maintenance-logs/1 to see the detail page for log entry #1.
Troubleshooting
- • If you see "404 Not Found" when visiting /maintenance-logs/1, make sure you have at least one log entry in the database. Use Tinker to create one if needed.
- • If you see "Trying to get property of non-object", the $log variable might be null. Make sure findOrFail() is being used correctly and the ID exists in the database.