'integer', 'size_bytes' => 'integer', 'started_at' => 'datetime', 'finished_at' => 'datetime', ]; public function policy() { return $this->belongsTo(BackupPolicy::class, 'policy_id'); } /* Scopes */ public function scopeOk($q) { return $q->where('status', 'ok'); } public function scopeFailed($q) { return $q->where('status', 'failed'); } public function scopeRunning($q) { return $q->where('status', 'running'); } }