Эх сурвалжийг харах

Model relationship methods

Vijayakrishnan Krishnan 4 жил өмнө
parent
commit
97512929fe

+ 4 - 0
app/Models/Bill.php

@@ -20,4 +20,8 @@ class Bill extends Model
     {
         return $this->hasOne(Client::class, 'id', 'client_id');
     }
+
+    public function hcp() {
+        return $this->hasOne(Pro::class, 'id', 'hcp_pro_id');
+    }
 }

+ 4 - 0
app/Models/CareMonth.php

@@ -48,4 +48,8 @@ class CareMonth extends Model
         }
         return $targetBills;
     }
+
+    public function rmBill(){
+        return $this->hasOne(Bill::class, 'id', 'rm_bill_id');
+    }
 }

+ 4 - 0
app/Models/Client.php

@@ -22,6 +22,10 @@ class Client extends Model
         return $this->hasOne(Pro::class, 'id', 'cm_pro_id');
     }
 
+    public function rmm() {
+        return $this->hasOne(Pro::class, 'id', 'rmm_pro_id');
+    }
+
     public function prosInMeetingWith() {
         return Pro::where('in_meeting_with_client_id', $this->id)->get();
     }