Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

hasmany relationship in laravel

<?php
 
namespace AppModels;
 
use IlluminateDatabaseEloquentModel;
 
class Post extends Model
{
    /**
     * Get the comments for the blog post.
     */
    public function comments()
    {
        return $this->hasMany(Comment::class);
    }
}
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #hasmany #relationship #laravel
ADD COMMENT
Topic
Name
1+7 =