There are two types of relationships between CRUDs in our system:

  • BelongsTo (1-to-many)
  • BelongsToMany (many-to-many)

To create a many-to-many relationship, you need to choose a field type called BelongsToMany Relationship.

CRUD Relationships Many-to-Many

QuickAdminPanel will generate a lot of things automatically for you. The most important settings are at the bottom of the screenshot above:

  • Relationship model: choose the "related" CRUD for belongsToMany function
  • Field to show in list: what field from that "related" CRUD should be shown in your current CRUDs list table (usually something like "name" or "title")

You don't need to create any additional fields, tables or settings. QuickAdminPanel will automatically create a pivot table between CRUDs, foreign keys in migrations and model functions in both CRUDs with $this->belongsToMany() relationship.