Luiz
Luiz
FFilament
Created by Luiz on 10/31/2024 in #❓┊help
Subnavigation position in blade
When I create the subnavigation I can choose the position between Start, End and Top. However, I want to place it in a specific space on the blade. How can I do this without having to create Tabs manually? Example:
<x-filament-panels::page>
{{ $this->selectClientsForm }}

---> SUBNAVIGATION HERE <---

{{ $this->table }}
</x-filament-panels::page>
<x-filament-panels::page>
{{ $this->selectClientsForm }}

---> SUBNAVIGATION HERE <---

{{ $this->table }}
</x-filament-panels::page>
3 replies
FFilament
Created by Luiz on 7/26/2024 in #❓┊help
image upload using URL
Has anyone managed to create a way to upload media via URL to the https://filamentphp.com/plugins/filament-spatie-media-library plugin? What I've managed to do so far is this:
Forms\Components\TextInput::make('url')
->label('URL')
->url()
->dehydrated(false)
->live(onBlur: true)
->suffixAction(
Forms\Components\Actions\Action::make('downloadFile')
->icon('heroicon-m-arrow-down-tray')
->action(function ($record, Get $get, Set $set, $state, \Filament\Forms\Components\Component $component) {
$contents = file_get_contents($state);
$fileName = Str::ulid();
$extension = pathinfo($state, PATHINFO_EXTENSION);
$fileNameWithExtension = $fileName . '.' . $extension;
$filePath = 'livewire-tmp/' . $fileNameWithExtension;

// $SpatieMediaLibraryFileUpload = $component->getContainer()->getComponent(fn ($childComponent) => $childComponent->getName() === 'media');

$storage = Storage::disk('local');

$storage->put($filePath, $contents);

$tempFile = TemporaryUploadedFile::createFromLivewire($fileNameWithExtension);

$media = $get('media');
$media[Str::uuid()->toString()] = $tempFile;

$set('media', $media);

$set('url', null);
})
)
Forms\Components\TextInput::make('url')
->label('URL')
->url()
->dehydrated(false)
->live(onBlur: true)
->suffixAction(
Forms\Components\Actions\Action::make('downloadFile')
->icon('heroicon-m-arrow-down-tray')
->action(function ($record, Get $get, Set $set, $state, \Filament\Forms\Components\Component $component) {
$contents = file_get_contents($state);
$fileName = Str::ulid();
$extension = pathinfo($state, PATHINFO_EXTENSION);
$fileNameWithExtension = $fileName . '.' . $extension;
$filePath = 'livewire-tmp/' . $fileNameWithExtension;

// $SpatieMediaLibraryFileUpload = $component->getContainer()->getComponent(fn ($childComponent) => $childComponent->getName() === 'media');

$storage = Storage::disk('local');

$storage->put($filePath, $contents);

$tempFile = TemporaryUploadedFile::createFromLivewire($fileNameWithExtension);

$media = $get('media');
$media[Str::uuid()->toString()] = $tempFile;

$set('media', $media);

$set('url', null);
})
)
However, nothing appears on the form and when I try to save it, an empty error occurs.
11 replies
FFilament
Created by Luiz on 7/1/2024 in #❓┊help
Spatie Media Library records media but does not display it.
I am using the Spatie Media Library package (https://filamentphp.com/plugins/filament-spatie-media-library). In the form I created the upload:
Forms\Components\SpatieMediaLibraryFileUpload::make('media')
->label('')
->multiple()
->image()
->imageEditor()
->reorderable()
->appendFiles()
Forms\Components\SpatieMediaLibraryFileUpload::make('media')
->label('')
->multiple()
->image()
->imageEditor()
->reorderable()
->appendFiles()
After saving the form, the media record is created in the Media table correctly, but the media disappears from my form as if it were empty. I also have the media column in my table (which I previously used with common upload), but nothing is saved in it. I believe it is not necessary. However, on my blade page I am trying to display the image but the return is empty:
$record->getFirstMediaUrl()
$record->getFirstMediaUrl()
What am I doing wrong?
25 replies
FFilament
Created by Luiz on 3/23/2024 in #❓┊help
disableOptionWhen
In the Relation Manager form I am using a Select. However, I want to disable the option that has already been used.
->disableOptionWhen(function (string $value) {
/* CHECK IF $VALUE ALREADY EXISTS WITH SAME PRODUCT_ID */
/* IF TRUE, DISABLE OPTION */
})
->disableOptionWhen(function (string $value) {
/* CHECK IF $VALUE ALREADY EXISTS WITH SAME PRODUCT_ID */
/* IF TRUE, DISABLE OPTION */
})
2 replies
FFilament
Created by Luiz on 1/2/2024 in #❓┊help
More than one invoice simultaneously.
No description
5 replies
FFilament
Created by Luiz on 12/30/2023 in #❓┊help
relation manager in tab
How do I insert the relation manager in my own tab? I have tabs in the form and I want to insert the relation manager in one of these tabs.
5 replies