I have a User model (id, first_name, last_name) and a Like model (id, to_user_id, isLiked), having a many to many relation.
I want to extract all the ids of a Like by a user, namely:
1) $user->likes It gives me all the Like model instances of the user, perfect!
2) But now I want only to extract the "id" from the instances. Doing something like this does not work: $user->likes->id
Can you help me find the proper way?
Thanks a mil! I've been struggling for hours now already...
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire