'decimal:3','recorded_at'=>'datetime']; public function device(): BelongsTo { return $this->belongsTo(Device::class); } public function scopeMetric($q, string $metric) { return $q->where('metric',$metric); } public function scopeSince($q, $ts) { return $q->where('recorded_at','>=',$ts); } }