|
@@ -132,6 +132,18 @@ class Client extends Model
|
|
|
->orderByRaw('ts DESC NULLS LAST');
|
|
|
}
|
|
|
|
|
|
+ public function recentMeasurements()
|
|
|
+ {
|
|
|
+ return $this->hasMany(Measurement::class, 'client_id', 'id')
|
|
|
+ ->where('is_removed', false)
|
|
|
+ ->whereNotNull('label')
|
|
|
+ ->where('label', '<>', 'SBP')
|
|
|
+ ->where('label', '<>', 'DBP')
|
|
|
+ ->where('is_cellular_zero', false)
|
|
|
+ ->orderByRaw('ts DESC NULLS LAST')
|
|
|
+ ->offset(0)->limit(20);
|
|
|
+ }
|
|
|
+
|
|
|
public function nonZeroMeasurements()
|
|
|
{
|
|
|
return $this->hasMany(Measurement::class, 'client_id', 'id')
|