malebestia.
Dispatch open modal with parameters
https://filamentphp.com/docs/3.x/support/blade-components/modal#controlling-a-modal-from-javascript
hello everyone,
in dispatch, in addition to the id, is there a way to pass other parameters and reuse them inside the content?
I find myself a page with a
@foreach($articles as $article) @livewire(\Modules\Blog\Http\Livewire\Widgets\RatingsWithImageWidget::class, ['article' => $article_model, 'ratings' => $article->ratings])
@endforeach
inside this RatingsWithImageWidget when an image is clicked,
I would like to start a simple modal, placed outside the foreach
<x-filament::modal>
{{-- Modal content --}}
</x-filament::modal>
with inside a content with updated data that I would like to send each time, for example the title of the article
2 replies
modal does not work if opened repeatedly
hello everyone,
when using modals it often happens to me that:
- I click on the appropriate button and the modal is displayed, having as a background all the blackout of the rest of the monitor
- I close it and immediately after I click on the button again to reopen it but this time I only see the blackout, the modal is not displayed
what could it be?
what advice?
thanks in advance
2 replies
action with form with livewire component inside
hello everyone, i added an action inside my livewire component, this is the code:
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
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
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
to update the data of the MyComponent component I thought of using in the select afterStateUpdated $this->dispatch and in my livewire component
but it seems that the event is not listened, what am I doing wrong?
thanks in advance
4 replies
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 advance2 replies
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
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
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
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
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