Tag Archives: modal relationship in laravel

Model Relationhsip in Laravel

Hello World, Today i am going to discuss model relationship in laravel. We will extends our previous tutorial in which we fetch data from database with ajax in laravel. In previous tutorial, We are fetching posts from database. In this tutorial, We will add comments in database to specific post and then fetch specific post comments with One to Many Relationship.

I have divided this tutorial in following steps:

  • About model relationship
  • About eloquent ORM
  • One to Many Relationship
  • Define comment model
  • Define One to Many¬†relationship
  • Fetch specific post comments with model relationship in post controller
  • Create post detail blade template
  • Add some dummy comments with laravel factory
  • Run the project

Continue reading