How I fetch the data in Laravel using one foreign key in one table at multiple times?

Viewed 52

Here is the attached image to show what I'm asking for?

enter image description here

In the CheckedIn model, I want to get the data that belong to the foreign key called checkInUserID.

1 Answers

You have to create a relationship between the two tables in your Modal. This will let you directly access all the values that are in relation to that particular Modal.

To know how it works check out Eloquent-Relationships

You can also check out this tutorial Laracast-Foreign-Keys (Highly recommended for understanding)

Related