| @@ 13-24 (lines=12) @@ | ||
| 10 | ||
| 11 | trait HandlesCheckResult |
|
| 12 | { |
|
| 13 | public function succeed(string $message = '') |
|
| 14 | { |
|
| 15 | $this->status = CheckStatus::SUCCESS; |
|
| 16 | $this->last_run_message = $message; |
|
| 17 | ||
| 18 | $this->save(); |
|
| 19 | ||
| 20 | event(new CheckSucceeded($this)); |
|
| 21 | ConsoleOutput::info($this->host->name.": check `{$this->type}` succeeded"); |
|
| 22 | ||
| 23 | return $this; |
|
| 24 | } |
|
| 25 | ||
| 26 | public function warn(string $warningMessage = '') |
|
| 27 | { |
|
| @@ 26-38 (lines=13) @@ | ||
| 23 | return $this; |
|
| 24 | } |
|
| 25 | ||
| 26 | public function warn(string $warningMessage = '') |
|
| 27 | { |
|
| 28 | $this->status = CheckStatus::WARNING; |
|
| 29 | $this->last_run_message = $warningMessage; |
|
| 30 | ||
| 31 | $this->save(); |
|
| 32 | ||
| 33 | event(new CheckWarning($this)); |
|
| 34 | ||
| 35 | ConsoleOutput::info($this->host->name.": check `{$this->type}` issued warning"); |
|
| 36 | ||
| 37 | return $this; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function fail(string $failureReason = '') |
|
| 41 | { |
|
| @@ 40-52 (lines=13) @@ | ||
| 37 | return $this; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function fail(string $failureReason = '') |
|
| 41 | { |
|
| 42 | $this->status = CheckStatus::FAILED; |
|
| 43 | $this->last_run_message = $failureReason; |
|
| 44 | ||
| 45 | $this->save(); |
|
| 46 | ||
| 47 | event(new CheckFailed($this)); |
|
| 48 | ||
| 49 | ConsoleOutput::error($this->host->name.": check `{$this->type}` failed"); |
|
| 50 | ||
| 51 | return $this; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||