Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
50
app/Support/Health/Checks/ExpiredCalls.php
Normal file
50
app/Support/Health/Checks/ExpiredCalls.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Support\Health\Checks;
|
||||
|
||||
use App\Enums\CallStatus;
|
||||
use App\Filament\Resources\Calls\CallResource;
|
||||
use App\Models\Call;
|
||||
use App\Support\Health\Check;
|
||||
use App\Support\Health\Finding;
|
||||
|
||||
/**
|
||||
* Calls whose closing date has passed but which are still marked open.
|
||||
*
|
||||
* They already drop off the public site — the `open` scope respects the date —
|
||||
* so this is not a visitor-facing fault. It is a housekeeping one: the panel
|
||||
* shows a count of open calls in the sidebar, and a number padded with
|
||||
* openings nobody is filling is a number that stops being read.
|
||||
*/
|
||||
class ExpiredCalls implements Check
|
||||
{
|
||||
public function key(): string
|
||||
{
|
||||
return 'expired-calls';
|
||||
}
|
||||
|
||||
public function permission(): ?string
|
||||
{
|
||||
return 'calls.view_any';
|
||||
}
|
||||
|
||||
public function run(): Finding
|
||||
{
|
||||
$expired = Call::query()
|
||||
->where('status', CallStatus::Open)
|
||||
->whereNotNull('closes_at')
|
||||
->where('closes_at', '<', now())
|
||||
->get(['id', 'title', 'closes_at']);
|
||||
|
||||
return Finding::problem(
|
||||
$this->key(),
|
||||
$expired->count(),
|
||||
url: CallResource::getUrl('index'),
|
||||
samples: $expired
|
||||
->map(fn (Call $call) => $call->getTranslation('title', (string) config('locales.default'), false))
|
||||
->all(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user