Level 3
how you transform data can you show it ?? or the method you using ??
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I am have a problem in the relationship many to many. after executing, only pivot data appears.
In Member model
. . .
class Member extends Authenticatable {
public function interest() {
return $this->belongsToMany(Interest::class, 'member_interest', 'member_id', 'interest_id');
}
. . .
I try to transform data on Resource API. and result data below
. . .
"interest": [
{
"pivot": {
"member_id": 1,
"interest_id": 1
}
},
{
"pivot": {
"member_id": 1,
"interest_id": 2
}
},
{
"pivot": {
"member_id": 1,
"interest_id": 3
}
}
],
why data from interest tables does not appear?
thanks a lot of
Please or to participate in this conversation.