Skip to content

Commit

Permalink
Merge pull request #37 from codebar-ag/feature-v3
Browse files Browse the repository at this point in the history
Health Checks
  • Loading branch information
StanBarrows authored Jul 3, 2023
2 parents c8b27df + b61595f commit ca333b7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
"illuminate/contracts": "^10.0",
"spatie/laravel-csp": "^2.8",
"spatie/laravel-enum": "^3.0",
"spatie/laravel-health": "^1.22",
"spatie/laravel-package-tools": "^1.14",
"spatie/laravel-ray": "^1.32"
"spatie/laravel-ray": "^1.32",
"spatie/security-advisories-health-check": "^1.0"
},
"require-dev": {
"laravel/pint": "^1.5",
Expand Down
1 change: 1 addition & 0 deletions config/laravel-default.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,6 @@
'fonts.googleapis.com/'.
'rsms.me/inter/',
],

],
];
24 changes: 24 additions & 0 deletions src/Checks/FailedJobsCheck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace CodebarAg\LaravelDefault\Checks;

use Illuminate\Support\Facades\DB;
use Spatie\Health\Checks\Check;
use Spatie\Health\Checks\Result;

class FailedJobsCheck extends Check
{
public function run(): Result
{
$count = DB::table('failed_jobs')->count();

$result = Result::make();
$result->shortSummary("failed jobs table count: {$count}");

if ($count == 0) {
return $result->ok();
}

return $result->failed();
}
}

0 comments on commit ca333b7

Please sign in to comment.