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:
54
app/Support/Health/Checks/UnansweredSubmissions.php
Normal file
54
app/Support/Health/Checks/UnansweredSubmissions.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Support\Health\Checks;
|
||||
|
||||
use App\Filament\Resources\Applications\ApplicationResource;
|
||||
use App\Models\Application;
|
||||
use App\Support\Health\Check;
|
||||
use App\Support\Health\Finding;
|
||||
use App\Support\Health\Severity;
|
||||
|
||||
/**
|
||||
* People who wrote in over a week ago and have had no answer.
|
||||
*
|
||||
* The only check here that measures somebody else's time rather than ours.
|
||||
* Somebody offered to help a volunteer collective and heard nothing back,
|
||||
* which costs more than any of the other faults on this page.
|
||||
*/
|
||||
class UnansweredSubmissions implements Check
|
||||
{
|
||||
/** Days after which silence stops being a delay and starts being an answer. */
|
||||
protected const GRACE_DAYS = 7;
|
||||
|
||||
public function key(): string
|
||||
{
|
||||
return 'unanswered-submissions';
|
||||
}
|
||||
|
||||
public function permission(): ?string
|
||||
{
|
||||
// Counting them is knowing they exist, and who may know that is the
|
||||
// same question as who may read the inbox.
|
||||
return 'applications.view_any';
|
||||
}
|
||||
|
||||
public function run(): Finding
|
||||
{
|
||||
$waiting = Application::query()
|
||||
->pending()
|
||||
->where('created_at', '<', now()->subDays(self::GRACE_DAYS))
|
||||
->get(['id', 'name', 'created_at']);
|
||||
|
||||
return Finding::problem(
|
||||
$this->key(),
|
||||
$waiting->count(),
|
||||
Severity::Error,
|
||||
url: ApplicationResource::getUrl('index'),
|
||||
samples: $waiting
|
||||
->map(fn (Application $a) => $a->name.' · '.$a->created_at->diffForHumans())
|
||||
->all(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user