Skip to main content

Code Examples of belongsToMany

Discover how to use Laravel's belongsToMany method in real-world applications. Browse 9 examples from popular open-source projects.

9 examples

monicahq/monica

  • 23719
  • Created Jul 2017
  • Updated Nov 2025

Files in this example

  • app/Models/Instance/Emotion/Emotion.php
    • database/migrations/2018_12_09_145956_create_emotion_call_table.php
View full example

serversideup/financial-freedom

  • 2760
  • Created Mar 2021
  • Updated Nov 2025

Files in this example

  • app/Models/Transactions/Transaction.php
    • app/Services/Transactions/AddTransaction.php
View full example

agorakit/agorakit

  • 435
  • Created May 2016
  • Updated Dec 2025

Files in this example

  • app/Group.php
    • app/Http/Controllers/GroupMassMembershipController.php
View full example

academico-sis/academico

  • 338
  • Created Dec 2018
  • Updated Nov 2025

Files in this example

  • app/Models/Enrollment.php
    • app/Http/Controllers/ScheduledPaymentController.php
View full example

LaraBug/larabug-app

  • 218
  • Created Apr 2021
  • Updated Oct 2023

Files in this example

  • app/Models/User.php
    • app/Http/Controllers/ProjectController.php
      • app/Models/Project.php
View full example

jcergolj/laravellte

  • 216
  • Created Jan 2020
  • Updated Feb 2023

Files in this example

  • app/Models/Permission.php
    • database/migrations/2023_03_26_110250_create_permission_role_table.php
      • app/Models/User.php
View full example

aschmelyun/laravel-job-board

  • 173
  • Created Mar 2021
  • Updated Apr 2025

Files in this example

  • app/Models/Listing.php
    • app/Http/Controllers/ListingController.php
View full example

JustinByrne/Mealing

  • 99
  • Created Oct 2020
  • Updated Sep 2022

Files in this example

  • app/Models/Recipe.php
    • resources/views/recipes/show.blade.php
      • database/migrations/2020_12_03_150502_add_quantity_to_ingredient_meal_pivot_table.php
View full example

familytree365/backend

  • 90
  • Created May 2021
  • Updated Aug 2021

Files in this example

  • app/Models/User.php
    • database/migrations/landlord/2021_05_30_082351_create_chat_members_table.php
View full example

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.