hasOne(ProductPhotoDocuments::class,'real_estates_id')->where('type',0); } public function realEstatePhoto(){ return $this->hasMany(ProductPhotoDocuments::class,'real_estates_id')->where('type',0); } public function realEstateDocuments(){ return $this->hasMany(ProductPhotoDocuments::class,'real_estates_id')->where('type',1); } public function companies(){ return $this->belongsTo(Company::class,'platform_partner'); } }