MitchBricks
MitchBricks
FFilament
Created by MitchBricks on 9/4/2024 in #❓┊help
Nested repeater not maintaining order
Hi all, I use a repeater inside a builder, in a resource that uses the Spatie Translatable plugin. When I set a order, and save it, all is fine. When I reload and change something else and then save, the order is mixed up. I also notice this on another project, so it seems it maybe has a correlation with the translateable plugin for Filament. There are no errors, the array is just malformed. The blocks in the builder do keep their order, that works fine. It is not a relation, all stored in JSON column in db. Does anymore maybe experienced the same?
Forms\Components\Repeater::make('click_through_items')
->label('Items na doorklikken')
->reorderableWithButtons()
->collapsed()
->collapsible()
->schema([
Forms\Components\TextInput::make('title')
->live()
->label('Titel'),
TiptapEditor::make('text_vic_tory')
->output(TiptapOutput::Html)
->label('Tekst bij mouseover'),
Forms\Components\TextInput::make('click_url')
->label('Verwijzing bij klikken (url)')
])
Forms\Components\Repeater::make('click_through_items')
->label('Items na doorklikken')
->reorderableWithButtons()
->collapsed()
->collapsible()
->schema([
Forms\Components\TextInput::make('title')
->live()
->label('Titel'),
TiptapEditor::make('text_vic_tory')
->output(TiptapOutput::Html)
->label('Tekst bij mouseover'),
Forms\Components\TextInput::make('click_url')
->label('Verwijzing bij klikken (url)')
])
3 replies
FFilament
Created by MitchBricks on 8/16/2023 in #❓┊help
spatie-laravel-media-library-plugin creates Media model and then deletes afterwards
Hi everyone, I am trying the spatie-laravel-media-library-plugin plugin from the Filament team. I have added it to my resource:
SpatieMediaLibraryFileUpload::make('trip_image')
->collection('default')
->translateLabel()
SpatieMediaLibraryFileUpload::make('trip_image')
->collection('default')
->translateLabel()
As per documentation. It has two conversions. The uploading works, when I save I see in Clockworks (similar to debugbar) that the media is created in the database along with the conversions:
Media
INSERT INTO `media` (
`name`,
`file_name`,
`DISK`,
`conversions_disk`,
`collection_name`,
`mime_type`,
`size`,
`custom_properties`,
`generated_conversions`,
`responsive_images`,
`manipulations`,
`model_id`,
`model_type`,
`uuid`,
`order_column`,
`updated_at`,
`created_at`
)
VALUES (
'pexels-photo-1884574 (1)',
'YZSVoTAZjoZ3g3XNxGsnrWjQtLj6Fu-metacGV4ZWxzLXBob3RvLTE4ODQ1NzQgKDEpLmpwZWc=-.jpg',
'public',
'public',
'default',
'image/jpeg',
126725,
'[]',
'[]',
'[]',
'[]',
4,
'Domain\\Trips\\Models\\Trip',
'fab0db9b-fc51-4a19-b988-5c9da102af0f',
1,
'2023-08-16 08:33:27',
'2023-08-16 08:33:27'
)
FileAdder.php:441
3.27 ms
Media
UPDATE `media`
SET `generated_conversions` = '{\"trip-item\":true}',
`media`.`updated_at` = '2023-08-16 08:33:27'
WHERE `id` = 8
Media.php:459
4.57 ms
Media
UPDATE `media`
SET `generated_conversions` = '{\"trip-item\":true,\"trip-page\":true}',
`media`.`updated_at` = '2023-08-16 08:33:27'
WHERE `id` = 8
Media
INSERT INTO `media` (
`name`,
`file_name`,
`DISK`,
`conversions_disk`,
`collection_name`,
`mime_type`,
`size`,
`custom_properties`,
`generated_conversions`,
`responsive_images`,
`manipulations`,
`model_id`,
`model_type`,
`uuid`,
`order_column`,
`updated_at`,
`created_at`
)
VALUES (
'pexels-photo-1884574 (1)',
'YZSVoTAZjoZ3g3XNxGsnrWjQtLj6Fu-metacGV4ZWxzLXBob3RvLTE4ODQ1NzQgKDEpLmpwZWc=-.jpg',
'public',
'public',
'default',
'image/jpeg',
126725,
'[]',
'[]',
'[]',
'[]',
4,
'Domain\\Trips\\Models\\Trip',
'fab0db9b-fc51-4a19-b988-5c9da102af0f',
1,
'2023-08-16 08:33:27',
'2023-08-16 08:33:27'
)
FileAdder.php:441
3.27 ms
Media
UPDATE `media`
SET `generated_conversions` = '{\"trip-item\":true}',
`media`.`updated_at` = '2023-08-16 08:33:27'
WHERE `id` = 8
Media.php:459
4.57 ms
Media
UPDATE `media`
SET `generated_conversions` = '{\"trip-item\":true,\"trip-page\":true}',
`media`.`updated_at` = '2023-08-16 08:33:27'
WHERE `id` = 8
Then, a bit later, it deletes it:
DELETE FROM `media`
WHERE `id` = 8
DELETE FROM `media`
WHERE `id` = 8
I have no clue why, and I also don't get any errors logged anywhere. Is there anyone who encountered this before and managed to fix this? Thanks!
2 replies