소스 검색

Visit UI - Point::getGlobalSingletonOfCategory()

Vijayakrishnan 3 년 전
부모
커밋
c1b228683b
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      app/Models/Point.php

+ 8 - 0
app/Models/Point.php

@@ -28,6 +28,14 @@ class Point extends Model
         return $this->hasOne(Note::class, 'id', 'last_child_plan_point_scoped_note_id');
     }
 
+    public static function getGlobalSingletonOfCategory(Client $_patient, String $_category) {
+        return Point
+            ::where('client_id', $_patient->id)
+            ->where('category', $_category)
+            ->orderBy('created_at', 'DESC')
+            ->first();
+    }
+
     public static function getIntakePointsOfCategory(Client $_patient, String $_category, Note $_note) {
         $points = Point
             ::where('client_id', $_patient->id)