Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

1 to many relationship in Laravel

class Post extends Model
{
   // 1 Post has many comments
    public function comments()
    {
        return $this->hasMany(Comment::class);
    }
}
Source by devsenv.com #
 
PREVIOUS NEXT
Tagged: #relationship #Laravel
ADD COMMENT
Topic
Name
9+4 =