We will now allow users to create their own posts and display them in their profile page. Posts will also be the main information displayed by our API.
We need first to generate the Post model. As usual, we will use
oil. Enter the following command line:
php oil generate model post content:varchar user_id:int created_at:int --no-timestamp
The output is as follows:
Creating model: APPPATH/classes/model/post.php Creating migration: APPPATH/migrations/001_create_posts.php
You can see that we used the
--no-timestamp parameter here. It simply prevents the automatic generation of the
updated_at columns. Since we can have a lot of posts and the
updated_at column then ...