In this code, we will need to follow the same approach used in all the chapters related with the user wall. We need to create a new table to hold the data, then create the table gateway to be able to access the data, and finally modify the controller to add the new type of content to the create()
method.
We are not going to modify the way API works or the way developers interact with the API. This means that we will keep using the same HTTP methods as before and will modify the create()
method to detect new content we want to add, and redirect the job to the proper specialized method.
Let's take a look at the structure of the new table we have to create to store the comments of the users.
This table is named user_comments
, and will hold the following data:
Id
User_id
Type
Entity_id
Comment
Created at
Updated at
Also, in this table, as with all the ones we already created, we will add two columns to store the time where a record is created and updated...