September 2017
Intermediate to advanced
244 pages
6h 44m
English
We are now going to create models. Model layer is related to the database, so we will also mention database relationships in them. Let's create models for all three tables that we have. The model names will be User, Post and Comment, relating to the users, posts and comments tables.
We don't need to create a User model and it comes with Lumen. To create Post and Comment models, let's run the following command that became available to us by using that flipbox/lumen-generator package. Run the following commands to make models:
This will create a Post model in the app directory:
php artisan make:model Post
This will create the Comment model in the app directory:
php artisan make:model Comment
If you look into these model files, ...
Read now
Unlock full access