This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I'm making a plugin with Builder, two Models "Documento" and "TipoDocumento", the Documento model has a field "tipodocumento_id" and TipoDocumento model has an "id" primary key, all is wotking fine, can show it in the lists correctly, can save it, but... when i edit a Documento on the relation field, it doesnt link the tipodocumento_id field to the dropdown, so it allways shows the default first option. ![List Image]https://i.ibb.co/NjPpxsK/Captura-de-pantalla-2019-09-04-15-05-04.png ![Form Image]https://i.ibb.co/kHhCHjH/Captura-de-pantalla-2019-09-04-15-05-12.png
My Documento model has:
protected $primaryKey = 'id';
public $belongsTo = [
'tipodocumento' => [
'MauricioPerez\Documentos\Models\TipoDocumento',
'table'=>'mauricioperez_documentos_tipodoc',
'order'=>'descripcion'
]
];
And my TipoDocumento model has:
public $hasMany = [
'documento' => [
'MauricioPerez\Documentos\Models\Documento',
'table'=>'mauricioperez_documentos_documento',
'key'=>'tipodocumento_id'
]
];
1-1 of 1