RobinDev
RobinDev
FFilament
Created by Remi Hindriks on 2/27/2024 in #❓┊help
Spatie Translatable Plugin and relationship fieldset
Im having the same issue, it worked before but not anymore
4 replies
FFilament
Created by vblinden on 3/21/2024 in #❓┊help
Translatable issue, adding random UUIDs (?)
i experience the same, you fixed it? @vblinden
3 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
Its fixed
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
Dan is going to look into it soon, will create a repo tomorrow too
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
with the builder and group relationships in the form builder i still have the issue that when i want to save another language than the default one, the fields get cleared out. Do you have any idea where i can catch this to fix this? Id love to fix it and PR it.
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
i have the code below but those functions dont get called when switching locale
Group::make()
->schema($schema)
->columns(2)
->columnSpanFull()
->visible(fn ($livewire) => count($schema) && !$livewire instanceof CreateRecord)
->relationship('customBlocks')
->mutateRelationshipDataBeforeCreateUsing(function ($data, $livewire) {
ray('mutateRelationshipDataBeforeCreateUsing');
$blocks = [];
foreach ($data as $key => $item) {
$blocks[$key] = $item;
unset($data[$key]);
}
$data['blocks'][$livewire->activeLocale] = $blocks;

return $data;
})
->mutateRelationshipDataBeforeSaveUsing(function ($data, $livewire) {
ray('mutateRelationshipDataBeforeSaveUsing');
$blocks = $livewire->record->blocks ?: [];
foreach ($data as $key => $item) {
$blocks[$key] = $item;
unset($data[$key]);
}
$data['blocks'][$livewire->activeLocale] = $blocks;

return $data;
})
->mutateRelationshipDataBeforeFillUsing(function ($data) {
ray('mutateRelationshipDataBeforeFillUsing');
if (is_array($data['blocks'])) {
foreach ($data['blocks'] ?? [] as $key => $item) {
$data[$key] = $item;
}
}

return $data;
}),
Group::make()
->schema($schema)
->columns(2)
->columnSpanFull()
->visible(fn ($livewire) => count($schema) && !$livewire instanceof CreateRecord)
->relationship('customBlocks')
->mutateRelationshipDataBeforeCreateUsing(function ($data, $livewire) {
ray('mutateRelationshipDataBeforeCreateUsing');
$blocks = [];
foreach ($data as $key => $item) {
$blocks[$key] = $item;
unset($data[$key]);
}
$data['blocks'][$livewire->activeLocale] = $blocks;

return $data;
})
->mutateRelationshipDataBeforeSaveUsing(function ($data, $livewire) {
ray('mutateRelationshipDataBeforeSaveUsing');
$blocks = $livewire->record->blocks ?: [];
foreach ($data as $key => $item) {
$blocks[$key] = $item;
unset($data[$key]);
}
$data['blocks'][$livewire->activeLocale] = $blocks;

return $data;
})
->mutateRelationshipDataBeforeFillUsing(function ($data) {
ray('mutateRelationshipDataBeforeFillUsing');
if (is_array($data['blocks'])) {
foreach ($data['blocks'] ?? [] as $key => $item) {
$data[$key] = $item;
}
}

return $data;
}),
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
i notice the builder doesnt work either, with blocks in them, they glitch when saving the second translation
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
Can you check if this is okay?
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
Nvm got it
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
No description
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
It is combined with your code so how do i do that? (i never did that before)
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
Can you implement my code too?
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
im going to test this in my big project right now to see if that works too
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
Yes!
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
But when i add the relationship name to the $translatable array in the model, it does work 🙂
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
i think we miss something for the repeaters in Resources > Pages > EditRecord > Concerns > Translatable
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
Can you test the function below, in the same file, this fixes the translatable search in tabels
public function applySearchConstraintToQuery(Builder $query, string $column, string $search, string $whereClause, ?bool $isCaseInsensitivityForced = null): Builder
{
/** @var Connection $databaseConnection */
$databaseConnection = $query->getConnection();

$column = match ($databaseConnection->getDriverName()) {
'pgsql' => "{$column}->>'{$this->activeLocale}'",
default => "JSON_UNQUOTE(JSON_EXTRACT(`{$column}`, '$.{$this->activeLocale}'))",
};

return $query->{$whereClause}(
new Expression(generate_search_column_expression($column, $isCaseInsensitivityForced, $databaseConnection)),
'like',
"%{$search}%",
);
}
public function applySearchConstraintToQuery(Builder $query, string $column, string $search, string $whereClause, ?bool $isCaseInsensitivityForced = null): Builder
{
/** @var Connection $databaseConnection */
$databaseConnection = $query->getConnection();

$column = match ($databaseConnection->getDriverName()) {
'pgsql' => "{$column}->>'{$this->activeLocale}'",
default => "JSON_UNQUOTE(JSON_EXTRACT(`{$column}`, '$.{$this->activeLocale}'))",
};

return $query->{$whereClause}(
new Expression(generate_search_column_expression($column, $isCaseInsensitivityForced, $databaseConnection)),
'like',
"%{$search}%",
);
}
116 replies
FFilament
Created by RobinDev on 11/10/2023 in #❓┊help
Repeater relationship translation not working
And then you can test this by create a Test at the TestResource
116 replies