Creating a View Page and Building the Comments System
The purpose of this section is to show the contacts of the CRUD in operation. The following screenshot shows you what we're planning to accomplish by the end of this section.
To make our contacts section more useful, let's add a
view page where we can see an individual contact. The
view page is also a perfect place to build a comments system to add comments against the contact:
- Open your
Contactscontroller and create a new method called
- Check that the
$idis numeric and then load the contact from
$contactis empty, redirect to a 404 page.
- Set the ...