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>
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Health\Checks;
|
|
|
|
use App\Filament\Resources\Services\ServiceResource;
|
|
use App\Models\Service;
|
|
use App\Support\Health\Check;
|
|
use App\Support\Health\Finding;
|
|
|
|
/**
|
|
* Published services with no published work behind them.
|
|
*
|
|
* A service that cannot point at something real is a promise, and a landing
|
|
* page made of promises is the kind visitors have learned to skim past. The
|
|
* listing already flags this in orange; this is the same fact where somebody
|
|
* will see it without going looking.
|
|
*/
|
|
class ServicesWithoutWork implements Check
|
|
{
|
|
public function key(): string
|
|
{
|
|
return 'services-without-work';
|
|
}
|
|
|
|
public function permission(): ?string
|
|
{
|
|
return 'services.view_any';
|
|
}
|
|
|
|
public function run(): Finding
|
|
{
|
|
$default = (string) config('locales.default');
|
|
|
|
$services = Service::query()
|
|
->published()
|
|
->whereDoesntHave('projects', fn ($q) => $q->published())
|
|
->get(['id', 'title']);
|
|
|
|
return Finding::problem(
|
|
$this->key(),
|
|
$services->count(),
|
|
url: ServiceResource::getUrl('index'),
|
|
samples: $services
|
|
->map(fn (Service $s) => $s->getTranslation('title', $default, false))
|
|
->all(),
|
|
);
|
|
}
|
|
}
|