-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add own action classes for egg actions (+ add empty state) (#823)
* add own action classes for egg actions * add empty state to ListEggs * put Import before Create
- Loading branch information
Showing
7 changed files
with
324 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?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('Export'); | ||
|
||
$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')); | ||
} | ||
} |
Oops, something went wrong.