vendredi 17 novembre 2017

Laravel/Mysql polymorphic relationship

I'm struggling finding the best way to define this relationship, having this models:

Event:
id
name
...

User:
id
name
password
group_id
...

Tmpuser:
id
name
...

Group:
id
name

Attendance:
event_id
attended

Basically i have an event that can be attended by users and tmpusers. but i need to "register" all the users from a group. i'm struggling definig which fields do i need on attendance to successfully reference the users, tmpuser and groups who attended to the event. i'm thinking that adding a "remote_id" and "remote_type" fields to attendance is enough to achieve what i want.

I'm also trying to make this "laravel eloquent compatible", but the closest way to do it is using polymorphic relationships, but those works on the other way of what i want.

Any ideas how to achieve this?

thank you in advance



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mDvUac
via IFTTT

Aucun commentaire:

Enregistrer un commentaire