ソースを参照

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)