lundi 20 janvier 2020

Laravel functions in pivot models?

We've got two tables that are in a relation to each other.

User and Booking.

The pivot model UserBooking sits between them.

We have a function that checks if there is also a specific value in the current record of UserBooking.

Where should this function be? In the user model or in the pivot model?

If this function returns something from UserBooking, it should be nested there I guess. How would I call this function in Laravel?

Is this a common pattern in Laravel? Whats the best practice?

Aucun commentaire:

Enregistrer un commentaire