Support the ongoing development of Laravel.io →
Eloquent Laravel Database
Last updated 2 years ago.
0

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",
     },
   }
Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.