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:
51
app/Support/Health/Checks/TestimonialsMissingOriginal.php
Normal file
51
app/Support/Health/Checks/TestimonialsMissingOriginal.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Support\Health\Checks;
|
||||
|
||||
use App\Filament\Resources\Testimonials\TestimonialResource;
|
||||
use App\Models\Testimonial;
|
||||
use App\Support\Health\Check;
|
||||
use App\Support\Health\Finding;
|
||||
use App\Support\Health\Severity;
|
||||
|
||||
/**
|
||||
* Quotes published without the words that were actually said.
|
||||
*
|
||||
* Every testimonial declares the language it was given in. When that language
|
||||
* is the one field left empty, the site is publishing a translation of
|
||||
* something nobody can check — which is the one way a testimonial stops being
|
||||
* evidence and starts being copywriting.
|
||||
*/
|
||||
class TestimonialsMissingOriginal implements Check
|
||||
{
|
||||
public function key(): string
|
||||
{
|
||||
return 'testimonials-missing-original';
|
||||
}
|
||||
|
||||
public function permission(): ?string
|
||||
{
|
||||
return 'testimonials.view_any';
|
||||
}
|
||||
|
||||
public function run(): Finding
|
||||
{
|
||||
$offenders = Testimonial::query()
|
||||
->public()
|
||||
->get(['id', 'quote', 'original_locale', 'author_name'])
|
||||
->filter(fn (Testimonial $t) => blank($t->getTranslation('quote', $t->original_locale, false)));
|
||||
|
||||
return Finding::problem(
|
||||
$this->key(),
|
||||
$offenders->count(),
|
||||
Severity::Error,
|
||||
url: TestimonialResource::getUrl('index'),
|
||||
samples: $offenders
|
||||
->map(fn (Testimonial $t) => $t->author_name.' ('.$t->original_locale.')')
|
||||
->values()
|
||||
->all(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user