Defining Relationships: One To Many
Is used to define relationships where a single model owns any amount of other models.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
/**
* Get the comments for the blog post.
*/
public function comments()
{
return $this->hasMany('App\Comment');
}
}
Semantic portal