Spatie Translatable non translated fields

Hi guys, it seems there issue with the plugin, it looks it can't handle non translated fields in the edit mutate, maybe an update causes this i previously used the plugin with laravel 10 and didn't face this issue, but now using laravel 11 and thank you
4 Replies
Lara Zeus
Lara Zeus3w ago
can you provide a code to reproduce the issue also maybe try with our fork: https://github.com/lara-zeus/translatable
Haydra
HaydraOP2w ago
the issue that any field not in the spatie translatable array defined in the model, is nit being recognized in the edit mutate in the edit page, code:
protected function mutateFormDataBeforeSave(array $data): array
{
$post = $this->getRecord();
if ($post->status != $data['status'] && $data['status'] == PostConstants::PUBLISHED) {
$data['published_at'] = Carbon::now();
}
}
protected function mutateFormDataBeforeSave(array $data): array
{
$post = $this->getRecord();
if ($post->status != $data['status'] && $data['status'] == PostConstants::PUBLISHED) {
$data['published_at'] = Carbon::now();
}
}
the error :
Undefined array key "status"
Undefined array key "status"
the status is not disabled or hydrated, the problem happened after i used the translate plugin, and the when i add 'status' to the model translatable array the error was solved
Lara Zeus
Lara Zeus2w ago
can you test that on the fork I mentioned? if still there I will try to find a fix for it
Haydra
HaydraOP6d ago
sorry, but i don't know how to test it on the repository what could cause the problem? could a recorded video helps ? @Lara Zeus i figured out the problem, when i removed the tab merge it worked fine why would this happen ? it's used in the edit page
public function hasCombinedRelationManagerTabsWithContent(): bool
{
return true;
}
public function hasCombinedRelationManagerTabsWithContent(): bool
{
return true;
}

Did you find this page helpful?