I have following tables.
Users
id
name
Events
id
name
Cards
id
name
Transfers
id
event_id
card_id
An user has many events and cards. An user can accepts cards from other user which he met at an event.A row will be added under transfers table whenever a card is accepted by a user, this row links a card_id
with event_id
. I am looking for a way to check a card (card_id
) is added under the transfers table for a logged in user's event(event_id
).
eg:-
auth()->user()->events->transfers->where(([['card_id', '=',$cardid]])->find());
Can someone help me by telling what is the best way to handle above situation using eloquent?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire