malebestia.
malebestia.
FFilament
Created by malebestia. on 11/15/2024 in #❓┊help
action with form with livewire component inside
hello everyone, i added an action inside my livewire component, this is the code:
public function checkModal(): Action
{
return Action::make('transaction')
->action(function (array $arguments, array $data): void {
$item_id = $this->item->id;
//make something
})
->fillForm(fn ($record, $arguments): array => [
'option_id' => $arguments['option_id'],
'amount' => 0,
])
->form([
Select::make('option_id')
->prefix(__('item::article.select-option'))
->hiddenLabel()
->options($this->option_opts)
->required()
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-prices');
}),
TextInput::make('amount')
->hiddenLabel()
->numeric()
->rules('gt:0')
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-stock');
}),
Livewire::make(TransactionInformation::class, fn (Get $get) => [
'amount' => $get('amount'),
'item_uuid' => $this->item_uuid,
'option_id' => $get('option_id'),
'option_options' => array_keys($this->option_opts),
]),
])

}
public function checkModal(): Action
{
return Action::make('transaction')
->action(function (array $arguments, array $data): void {
$item_id = $this->item->id;
//make something
})
->fillForm(fn ($record, $arguments): array => [
'option_id' => $arguments['option_id'],
'amount' => 0,
])
->form([
Select::make('option_id')
->prefix(__('item::article.select-option'))
->hiddenLabel()
->options($this->option_opts)
->required()
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-prices');
}),
TextInput::make('amount')
->hiddenLabel()
->numeric()
->rules('gt:0')
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-stock');
}),
Livewire::make(TransactionInformation::class, fn (Get $get) => [
'amount' => $get('amount'),
'item_uuid' => $this->item_uuid,
'option_id' => $get('option_id'),
'option_options' => array_keys($this->option_opts),
]),
])

}
as you can see, inside the action form I use another livewire component TransactionInformation that calculates and displays a result, which I would then like to reuse inside the action business logic, basically inside ->action(function (array $arguments, array $data). I thought I would find something inside $arguments or $data, but I don't see anything. how do I retrieve a TransactionInformation property? where am I going wrong? I hope I explained my problem well, thanks in advance
2 replies
FFilament
Created by malebestia. on 11/14/2024 in #❓┊help
Injecting the current Livewire component instance
Hi everyone, sorry but I'm a noob, could you give me an example of use regarding this paragraph of the documentation? https://filamentphp.com/docs/3.x/forms/advanced#injecting-the-current-livewire-component-instance
3 replies
FFilament
Created by malebestia. on 11/4/2024 in #❓┊help
livewire component with event in form
hello everyone, I have inserted inside my form, a select and a livewire component that simply has to display a blade with data (html and css), which should update when the state of the select changes
->form([
Select::make('rating_id')
->prefix('Your choise')
->hiddenLabel()
->options($this->array_opts)
->required()
->reactive()
->afterStateUpdated(function (?string $state, ?string $old) {
$this->dispatch('my_event', rating_id: $state);
}),
Livewire::make(MyComponent::class, ['article_uuid' => $this->article_uuid, 'rating_id' => $this- >rating_id]),
])
->form([
Select::make('rating_id')
->prefix('Your choise')
->hiddenLabel()
->options($this->array_opts)
->required()
->reactive()
->afterStateUpdated(function (?string $state, ?string $old) {
$this->dispatch('my_event', rating_id: $state);
}),
Livewire::make(MyComponent::class, ['article_uuid' => $this->article_uuid, 'rating_id' => $this- >rating_id]),
])
to update the data of the MyComponent component I thought of using in the select afterStateUpdated $this->dispatch and in my livewire component
#[On('my_event')]
public function doSomething(string $rating_id): array
{
dd('ok');
//do something
}
#[On('my_event')]
public function doSomething(string $rating_id): array
{
dd('ok');
//do something
}
but it seems that the event is not listened, what am I doing wrong? thanks in advance
4 replies
FFilament
Created by malebestia. on 9/12/2024 in #❓┊help
form padding
No description
3 replies
FFilament
Created by malebestia. on 7/12/2024 in #❓┊help
Table display via card or similar
Hello everyone, I'm using a MapTableWidget component in my frontend theme for users, to display the table of the created models I'm using this function: protected function getTableColumns(): array { return [ Tables\Columns\TextColumn::make('name') ->searchable(), Tables\Columns\TextColumn::make('priority.name') ->searchable(), Tables\Columns\TextColumn::make('type.name') ->searchable(), Tables\Columns\TextColumn::make('latitude') ->searchable(), Tables\Columns\TextColumn::make('longitude') ->searchable(), SpatieMediaLibraryImageColumn::make('images') ->collection('ticket'), ]; } which displays a normal table to me. I would like to view the table in a more pleasant way, perhaps with two cards per row, where inside I can view all the fields of the model, do you have any suggestions or examples? Thanks in advance
2 replies
FFilament
Created by malebestia. on 6/18/2024 in #❓┊help
use the ListRecord table function in Resources
with the aim of minimizing the code of the Resource file, can the table function be deleted using that of the related ListRecords?
2 replies
FFilament
Created by malebestia. on 6/13/2024 in #❓┊help
my getHeaderActions takes a long time to open its modal, what could it depend on?
my getHeaderActions takes a long time to open its modal, what could it depend on?
6 replies
FFilament
Created by malebestia. on 6/11/2024 in #❓┊help
email & sms import
No description
3 replies
FFilament
Created by malebestia. on 5/26/2024 in #❓┊help
manage a parameter inside the Importer
Hi everyone, for the first time I'm using the new csv import, inside a ManageRelatedRecords page. inside the importer I would need to manage the id of the parent object of this ManageRelatedRecords page, because I would have to, based on the id of the parent object, obtain different translations to then use in the labels of my importer. How can I, inside my Importer, get the id of the parent object? I hope I explained my need well, Thank you in advance
2 replies
FFilament
Created by malebestia. on 3/26/2024 in #❓┊help
unserialize(): Error at offset 16777211 of 16777215 bytes
Hi everyone, I updated my project to Laravel 11, now when I go to edit my Resource I get the following error: unserialize(): Error at offset 16777211 of 16777215 bytes (View: /var/www/html/my_project/laravel/vendor/filament/forms/resources/views/components/select.blade.php) (View: /var/www/html/my_project/laravel/vendor/filament/forms/resources/views/components/select.blade.php) (View: /var/www/html/my_project/laravel/vendor/filament/forms/resources/views/components/select.blade.php) any suggestions? Thanks in advance
2 replies
FFilament
Created by malebestia. on 3/6/2024 in #❓┊help
Block Repeater Rating with MorphToMany Relation
Greetings, I have a block with this form inside class Rating { public static function make( string $name = 'rating', string $context = 'form', ):Block { $views = [$view1, $viev2]; return Block::make($name) ->schema([ Select::make('_tpl') ->label('layout') ->options($views), Repeater::make('ratings') ->relationship() ->schema([ TextInput::make('title')->required(), ColorPicker::make('color'), SpatieMediaLibraryFileUpload::make('rating') ->collection('rating'), ]) ->reorderableWithButtons() ->reorderableWithDragAndDrop(true) ->columnSpanFull() ->columns(3), ]) // ->reorderableWithButtons() // ->addActionLabel('Add member') // ->label('Link to article') ->columns('form' === $context ? 2 : 1); } } used inside my ArticleResource resource, whose model has the relationship public function ratings(): MorphToMany { $pivot_class = RatingMorph::class; $pivot = app($pivot_class); $pivot_table = $pivot->getTable(); $pivot_db_name = $pivot->getConnection()->getDatabaseName(); $pivot_table_full = $pivot_db_name.'.'.$pivot_table; $pivot_fields = $pivot->getFillable(); return $this->morphToMany(Rating::class, 'model', $pivot_table_full) ->using($pivot_class) ->withPivot($pivot_fields) ->withTimestamps(); } when I do a save, everything is fine, but: - if I delete a rating, nothing inside the tables is deleted - if I import data via xls/json, when I view the edit page, the data is not displayed/loaded inside where am I wrong? any suggestions? Thanks in advance
2 replies
FFilament
Created by malebestia. on 2/26/2024 in #❓┊help
Slowness on the server
Hi everyone, has it ever happened to you that using Filament locally is perfect while on the server it is slow?
6 replies
FFilament
Created by malebestia. on 2/7/2024 in #❓┊help
multiple FileUpload in my form blocks
No description
3 replies
FFilament
Created by malebestia. on 1/15/2024 in #❓┊help
https://github.com/buildix/timex for V3
Hello everyone, do you know something about the update of this package https://github.com/buildix/timex for version 3 of Filament?
4 replies
FFilament
Created by malebestia. on 12/8/2023 in #❓┊help
frontend theme
Hi everyone, Is there any example of using filament for the frontend theme, i.e. for the theme that a guest user displays?
7 replies
FFilament
Created by malebestia. on 12/6/2023 in #❓┊help
Automatic creation of the schema form
Hi everyone, Is there any way to get the schema form starting from the class name of a resource? I would like to automatically check the schema form for each resource/model and if empty, insert the various elements automatically Thanks in advance
2 replies
FFilament
Created by malebestia. on 11/25/2023 in #❓┊help
Has anyone ever had this error?
Access level to Filament\Forms\Concerns\InteractsWithForms::getFormStatePath() must be public (as in class Filament\Resources\Pages\ViewRecord)
2 replies
FFilament
Created by malebestia. on 10/11/2023 in #❓┊help
cookie law and GDPR
Hi everyone, regarding gdpr and cookie law issues, does filament already have something ready to handle these things?
6 replies
FFilament
Created by malebestia. on 9/29/2023 in #❓┊help
Method Konnco\FilamentImport\Actions\ImportAction::table does not exist
Hello everyone, I need to use the ImportAction inside a RelationManager, unfortunately the following error appears: "Method Konnco\FilamentImport\Actions\ImportAction::table does not exist." advice?
11 replies
FFilament
Created by malebestia. on 9/20/2023 in #❓┊help
Call to undefined method Modules\MyModule\Filament\Resources\QuestionChartResource::getUrl()
Hello everyone, inside a RelationManager, in my table, I inserted the following custom action: ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\Action::make('regenImg2') ->label('regenerate2') ->icon('heroicon-o-arrow-path') ->url(fn ($record): string => QuestionChartResource::getUrl('regen-img-2', ['record' => $record, ...self::$route_params])), ]) as per this paragraph, https://filamentphp.com/docs/3.x/panels/resources/getting-started#generating-urls-to-resource-pages but it gives me the error "Call to undefined method Modules\MyModule\Filament\Resources\QuestionChartResource::getUrl()" suggestions on what I'm doing wrong? Thanks in advance
5 replies