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/Filament/Resources/Media/Pages/ListMedia.php
Normal file
50
app/Filament/Resources/Media/Pages/ListMedia.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\Media\Pages;
|
||||
|
||||
use App\Filament\Resources\Media\MediaResource;
|
||||
use App\Models\Media;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ListMedia extends ListRecords
|
||||
{
|
||||
protected static string $resource = MediaResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// The media table is derived, so rebuilding it is always safe and
|
||||
// is the answer to "I changed the widths, now what?".
|
||||
Action::make('reprocess_all')
|
||||
->label(__('panel.media.actions.reprocess_all'))
|
||||
->icon('heroicon-o-arrow-path')
|
||||
->color('gray')
|
||||
->requiresConfirmation()
|
||||
->modalDescription(__('panel.media.actions.reprocess_all_hint'))
|
||||
->visible(fn () => Auth::user()?->can('media.view_any'))
|
||||
->action(function (): void {
|
||||
Media::query()->update(['processed_at' => null]);
|
||||
|
||||
Notification::make()
|
||||
->title(__('panel.media.actions.reprocess_queued'))
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
public function getSubheading(): ?string
|
||||
{
|
||||
$total = Media::query()->get()->sum(fn (Media $m) => $m->totalSize());
|
||||
|
||||
return __('panel.media.subheading', [
|
||||
'count' => Media::query()->count(),
|
||||
'size' => round($total / 1024 / 1024, 1),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user