瀏覽代碼

Model relationship methods

Vijayakrishnan Krishnan 4 年之前
父節點
當前提交
97512929fe
共有 3 個文件被更改,包括 12 次插入0 次删除
  1. 4 0
      app/Models/Bill.php
  2. 4 0
      app/Models/CareMonth.php
  3. 4 0
      app/Models/Client.php

+ 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();
     }