Fix ImportEggAction (#1110)

* `Arr::Wrap` `data.files` cause if its unique its a string

* Use `data.url` first so it gets overwritten by `data.files`
This commit is contained in:
MartinOscar 2025-03-17 18:07:36 +01:00 committed by GitHub
parent f563128237
commit fbeb747fc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@ use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\Tabs\Tab;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Illuminate\Support\Arr;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
class ImportEggAction extends Action
@ -31,7 +32,7 @@ class ImportEggAction extends Action
$this->authorize(fn () => auth()->user()->can('import egg'));
$this->action(function (array $data, EggImporterService $eggImportService): void {
$eggs = array_merge($data['files'], collect($data['urls'])->flatten()->whereNotNull()->unique()->all());
$eggs = array_merge(collect($data['urls'])->flatten()->whereNotNull()->unique()->all(), Arr::wrap($data['files']));
if (empty($eggs)) {
return;
}

View File

@ -13,6 +13,7 @@ use Filament\Forms\Components\Tabs\Tab;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Tables\Actions\Action;
use Illuminate\Support\Arr;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
class ImportEggAction extends Action
@ -31,7 +32,7 @@ class ImportEggAction extends Action
$this->authorize(fn () => auth()->user()->can('import egg'));
$this->action(function (array $data, EggImporterService $eggImportService): void {
$eggs = array_merge($data['files'], collect($data['urls'])->flatten()->whereNotNull()->unique()->all());
$eggs = array_merge(collect($data['urls'])->flatten()->whereNotNull()->unique()->all(), Arr::wrap($data['files']));
if (empty($eggs)) {
return;
}