ralphjsmit
ralphjsmit
FFilament
Created by Matthew on 11/5/2024 in #❓┊help
Filtering a Select Box
You would need to test if CreateAction::make() works, but otherwise a normal Action::make('create') with a form and action works fine for sure.
11 replies
FFilament
Created by Matthew on 11/5/2024 in #❓┊help
Filtering a Select Box
Yes, that does work! You can add eg a tableHeaderAction() with a modal form and then it should work.
11 replies
FFilament
Created by ericmp on 11/4/2024 in #❓┊help
Add maxlength to 255 chars on TextInput by default
What you likely need to do is to provide a closure to maxLength() and only in that closure call getInputMode(). You need to imagine that ::configureUsing() is called immediately when someone does TextInput::make(). So at that point, if you call getInputMode() then the code in the configureUsing does not yet know what other methods are chained after it, so hence it doesn't work (what you also said). The solution therefore would be to fetch the getInputMode() at run-time, when the getMaxLength() function is actually being called:
TextInput::configureUsing(function (TextInput $component): void {
$component->maxLength(function (TextInput $component) {
$inputMode = $component->getInputMode();

if ($inputMode !== 'numeric' && $inputMode !== 'decimal') {
return 255;
}

return null;
});
});
TextInput::configureUsing(function (TextInput $component): void {
$component->maxLength(function (TextInput $component) {
$inputMode = $component->getInputMode();

if ($inputMode !== 'numeric' && $inputMode !== 'decimal') {
return 255;
}

return null;
});
});
7 replies
FFilament
Created by Mansoor Khan on 5/7/2024 in #❓┊help
Open a Modal when field state changes
Awesome!
7 replies
FFilament
Created by Mansoor Khan on 5/7/2024 in #❓┊help
Open a Modal when field state changes
You can try something like $livewire->mountFormComponentAction() or sth
7 replies
FFilament
Created by Prosp30 on 3/19/2024 in #❓┊help
Download PDF using Spatie Laravel-PDF on table action
Makes sense, I generally have a /debug route in my applications that's only available locally (and on production perhaps for admins), that's helpful sometimes a well
23 replies
FFilament
Created by Prosp30 on 3/19/2024 in #❓┊help
Download PDF using Spatie Laravel-PDF on table action
No idea tbh, perhaps you can look on how this is achieved in a generic Livewire component
23 replies
FFilament
Created by Prosp30 on 3/19/2024 in #❓┊help
Download PDF using Spatie Laravel-PDF on table action
Thanks for this! The echo and base64 part were very helpful tips. For reference, I just implemented PDF download using Spatie/laravel-pdf from an action like this:
Tables\Actions\Action::make('download_order_invoice')
->icon('heroicon-o-arrow-down-tray')
->label('Download invoice')
->action(function (Order $order) {
$pdfBuilder = Pdf::view('pdfs.order-invoice', ['order' => $order])
->format(Format::A4)
->name("order-{$order->uuid}.pdf");

return response()->streamDownload(function () use ($pdfBuilder) {
echo base64_decode($pdfBuilder->download()->base64());
}, $pdfBuilder->downloadName);
}),
Tables\Actions\Action::make('download_order_invoice')
->icon('heroicon-o-arrow-down-tray')
->label('Download invoice')
->action(function (Order $order) {
$pdfBuilder = Pdf::view('pdfs.order-invoice', ['order' => $order])
->format(Format::A4)
->name("order-{$order->uuid}.pdf");

return response()->streamDownload(function () use ($pdfBuilder) {
echo base64_decode($pdfBuilder->download()->base64());
}, $pdfBuilder->downloadName);
}),
23 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
It's a caveat I didn't know, but I think it makes sense
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
Nice!
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
Or even just hardcode a URL from internet instead of an input
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
Yes, agree!
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
You could try creating a quick reproduction repository for Filament and submit a bug report
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
It seems like the process() function sets this to false, so I think that the issue is somewhere there
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
No description
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
No me neither, at least I think if the preview doesn't reset when changed using $set/->state(), it could even be considered a bug
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
Yeah, I agree you would need some way to reset the Filepond thing, which is what you already concluded as well
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
But I like the idea behind the Unsplash integration.
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
OK, that's unfortunate! Then I'm out of ideas on this for now 🙂
42 replies
FFilament
Created by Mansoor Khan on 3/13/2024 in #❓┊help
Upload image from URL
No, I meant the $component variable:
->action(function (Set $set, $arguments, Component $livewire, FileUpload $component) {
// this saves the file to livewire-tmp dir
$filePath = UrlUploadedFile::createFromUrl($imageLink)
->store('livewire-tmp', ['disk' => 'local']);

$filePath = explode('/', $filePath)[1];

// Creates a TemporaryUploadedFile instance for given filepath/file
$file = TemporaryUploadedFile::createFromLivewire($filePath);

$component->state($file);
// or [$file], not sure what it accepts
})
->action(function (Set $set, $arguments, Component $livewire, FileUpload $component) {
// this saves the file to livewire-tmp dir
$filePath = UrlUploadedFile::createFromUrl($imageLink)
->store('livewire-tmp', ['disk' => 'local']);

$filePath = explode('/', $filePath)[1];

// Creates a TemporaryUploadedFile instance for given filepath/file
$file = TemporaryUploadedFile::createFromLivewire($filePath);

$component->state($file);
// or [$file], not sure what it accepts
})
42 replies