jeudi 10 mars 2016

Laravel refer to polymorphic type pivot table?

Hello I am currently stuck on a problem on how to refer to a pivot table record with a polymorphic relationship and I was hoping somebody could help me out.

Tables:

Pivot table for beers a user has checked in to his personal profile

beer_user

Table with user profiles

users

Table with polymorphic relationships

comments

I want to place a comment on a beer that a user has checked into his personal profile. So in other words comment on the pivot table table record of beer_user.

I have a commentable_type column in my polymorphic comments table in which I can refer to models but my pivot is not exactly a model. How can I refer to my pivot table in my commentable_type field? How can I comment on the exact combination of a specific beer_user combination?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire