Know the laravel eloquent model in detail !

Eloquent model in detail. It's a relationship between models and controllers. In general, model refers to the database table. Once you create a model you can use the methods those ships out of box with the model. But before that, we have to build a relationship with two or more tables. For simplicity, we will use two tables. Our first table name is Posts and the second table name is Tasks. In the first table, we will save the categories of the posts we make for our website. And in the second table we will save any detail information about the posts' created based on the categories. Say in the first table we just want to save the categories of the post. In our case, we will create two categories say Laravel and Centos. Posts model is created like this below class Posts extends Model { protected $gaurded = []; // public function tasks(){ return $this->hasMany(Tasks::class); } } And Tasks model is created like this below class Tasks extends Model { // protected $fillable =['posts_id', 'description', 'title']; public function posts(){ return $this->belongsTo(Posts::class); } }