Luiz
Luiz
FFilament
Created by Luiz on 1/15/2025 in #❓┊help
vertical spacing
How to reduce the vertical spacing between rows in an Infolist when using inlineLabel()? I'm noticing a lot of extra space between entries, and I want to make it more compact. Is there a way to do this, or should I use custom CSS?
2 replies
FFilament
Created by Luiz on 1/4/2025 in #❓┊help
Problem with Admin Panel Authentication - 403 Forbidden on Production
I'm having an issue with my Filament admin panel. On localhost, everything works fine, but on production, after logging in, I get a 403 Forbidden error. Here’s my setup: - I created a custom Admin model and set up a new guard admin in config/auth.php:
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],

'providers' => [
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
],
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],

'providers' => [
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
],
- I have two panels: - UserPanel using the User model and the default web guard. - AdminPanel using the Admin model and the admin guard. - My AdminPanelProvider.php config:
public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->path('admin')
->login()
->authGuard('admin')
...
;
}
public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->path('admin')
->login()
->authGuard('admin')
...
;
}
What I’ve done so far: - Tested locally: Works fine. - On production: The login page loads, but after logging in, it redirects and gives a 403 Forbidden. What I’ve checked: 1. The guard setup in auth.php is correct. 2. The Admin model is set up and has users in production. 3. The session domain and cookies in .env seem correct. 4. Cleared all caches (config:clear, route:clear, cache:clear, etc.). What could I be missing? Any help would be greatly appreciated!
5 replies
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