I have seen on tutorials people declaring the foreign key on one to many scenarios and others do not use it. Which is the way to go? Should we always use the foreing key definition, for example:
and second question, how to reference the model class in the relationship:
return $this->hasMany('App\Comment'); This one return $this->hasMany(Comment::class); Or this one
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.