mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 05:14:46 +02:00

* Use Filament labels. * use `trans` * Show more files No reason for this to be its own pr...
29 lines
743 B
PHP
29 lines
743 B
PHP
<?php
|
|
|
|
namespace App\Filament\Components\Actions;
|
|
|
|
use App\Models\Egg;
|
|
use App\Services\Eggs\Sharing\EggExporterService;
|
|
use Filament\Actions\Action;
|
|
|
|
class ExportEggAction extends Action
|
|
{
|
|
public static function getDefaultName(): ?string
|
|
{
|
|
return 'export';
|
|
}
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->label(trans('filament-actions::export.modal.actions.export.label'));
|
|
|
|
$this->authorize(fn () => auth()->user()->can('export egg'));
|
|
|
|
$this->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) {
|
|
echo $service->handle($egg->id);
|
|
}, 'egg-' . $egg->getKebabName() . '.json'));
|
|
}
|
|
}
|