fix the polymorph relation

This commit is contained in:
2024-12-25 14:49:33 +03:30
parent 33bcc5e496
commit 83d688af8e
2 changed files with 9 additions and 3 deletions

View File

@@ -172,14 +172,19 @@ class RoadItemsProject extends Model
{ {
return $this->morphToMany(CMMSMachine::class, return $this->morphToMany(CMMSMachine::class,
'machinable', 'machinable',
'cmms_machine_road_items_project', 'machinables',
'road_items_project_id', 'machinable_id',
'machine_id' 'machine_id'
); );
} }
public function rahdaran(): MorphToMany public function rahdaran(): MorphToMany
{ {
return $this->morphToMany(Rahdaran::class, 'rahdarable', 'rahdaran_road_items_project'); return $this->morphToMany(Rahdaran::class,
'rahdarable',
'rahdarables',
'rahdarable_id',
'rahdar_id',
);
} }
} }

View File

@@ -201,5 +201,6 @@ return [
'fields.*.type' => 'نوع فیلد', 'fields.*.type' => 'نوع فیلد',
'fields.*.option' => 'گزینه های فیلد', 'fields.*.option' => 'گزینه های فیلد',
'cmms_machine_id' => 'کد یکتا ماشین', 'cmms_machine_id' => 'کد یکتا ماشین',
'contract_subitem_id' => 'کد یکتای پروژه',
], ],
]; ];