I was able to solve. It was necessary to set the $incrementing
property to false
in the MemberLinkType
model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class MemberLinkType extends Model
{
public $timestamps = false;
public $incrementing = false;
protected $primaryKey = 'name';
}
After that, I got what I wanted:
$link = MemberLink::find(1)
=> App\MemberLink {#3071
id: 1,
member_link_type: "parent",
from_member_id: 11,
to_member_id: 12,
created_at: "2018-08-14 15:03:22",
updated_at: "2018-08-14 15:03:22",
from: App\Member {#3065
id: 11,
name: "Gabriela Espinoza",
},
to: App\Member {#3067
id: 12,
name: "Felipe Assunção",
},
type: App\MemberLinkType {#3066
name: "parent",
category: "family",
description: "Parent",
description_on_male: "dad",
description_on_female: "mom",
reverse_link: "child",
},
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community