slamx_
Error FileUpload Preview
In the current version in the FileUpload component, the APP_URL is tried to be called with www. for the preview of the file, but the app runs without www in the url and is also configured as such in the APP_URL. Is it possible to adjust this?
5 replies
Change active Tab via callback
Is it possible to change the Tab by dynamic value? I want to use Icons on the front-end to open a form inside a modal and want to show the selected Tab? Maybe something like:
$this->form->getComponent('tabCompName')->activeTab(3)
4 replies
Move Searchbar to Sidebar
Is it possible to add the searchbar on top of the Sidebar? The reason for this move is, that we add a notification tool inside the Topbar and on mobile there is not enough space for both, searchbar and notification badge.
6 replies
False/Null value not inside getState
In v2 the Form State of a toggle send also a false/null state inside the getState() function. In v3 they don't - is it possible to change inside the global form component settings?
The Form field is disabled based on a condition.
4 replies
How to call function inside custom form field
I'm new in writing a custom form field. I watched the laracast from Dan but I want to trigger some custom functions inside the Field Class. I tried a regular wire:click with naming the method but I get the following response:
Unable to call component method. Public method [$example] not found on component
This is my example form field:
namespace App\Forms\Components;
use Filament\Forms\Components\Field;
class CloudFileSelect extends Field
{
protected string $view = 'forms.components.cloud-file-select';
public function example()
{
dd('example');
}
}
And this is the view:
<x-dynamic-component
:component="$getFieldWrapperView()"
:field="$field"
>
<div class="z-10" x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
<button class="button hover:cursor-pointer" type="button" wire:click="example()">Open Example</button>
</div>
</x-dynamic-component>
I would be happy if someone can help me or give me a good source with a comprehensive example for writing my own field.60 replies
extraFieldWrapperAttributes does not exist
Hey I'm a bit confused, I try to use extraFieldWrapperAttributes on a TextInput like in the docs:
https://filamentphp.com/docs/3.x/forms/fields/getting-started#adding-extra-html-attributes
But I get the response:
Method Filament\Forms\Components\TextInput::extraFieldWrapperAttributes does not exist.
5 replies
Custom Listeners in v3
I want to create a dispatch inside a Form Field Action (like repeater::createItem), but how I can access the livewire instance like here in v2?
$livewire->emit('newRepeaterItemID', $newUuid);
I tried it via component, but it didn't work.
$component->dispatch('newRepeaterItemID', $newUuid);
Any Ideas how convert this v2 into v3? Maybe I'm on the wrong path 🙏
Here is a v2 Code-Snippet:
$this->registerListeners([
'repeater::createItem' => [
function (Repeater $component, string $statePath): void {
if ($statePath !== $component->getStatePath()) {
return;
}
$newUuid = (string) Str::uuid();
$livewire = $component->getLivewire();
data_set($livewire, "{$statePath}.{$newUuid}", []);
$component->getChildComponentContainers()[$newUuid]->fill();
$component->collapsed(false, shouldMakeComponentCollapsible: false);
$livewire->emit('newRepeaterItemID', $newUuid);
$livewire->emit('newRepeaterItem', $statePath);
},
],
2 replies
Fileupload - Error divison by zero
I use the following code for fileupload customization, but when I use Livewire\Features\SupportFileUploads\TemporaryUploadedFile I get a "divison by zero" error.
FileUpload::make('avatar')
->label('Avatar Upload')
->disk('s3')
->image()
->visibility('private')
->maxSize(1024)
->preserveFilenames()
->imageResizeTargetHeight(600)
->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file): string {
// store new file
$oriName = $file->getClientOriginalName();
$storeName = $file->getFilename();
$this->userAvatar = [
'user_id' => auth()->ufile()->id,
'file_name' => $oriName,
'file_path' => auth()->ufile()->filePath() . '/' . $storeName,
'is_public' => false,
'categories' => ['Avatar'],
'upload' => ['Avatar'],
];
return (string) str($file->getFilename());
})
->directory(auth()->ufile()->filePath()),
3 replies