Skip to content

Translation wrapper for multiple translations #437

@MohamedAbdel-wahed

Description

@MohamedAbdel-wahed

when i set transaltion wrapper in the config file to 'translations' and i want to use it like this:
Post::create([
'user_id'=> $id,
'translations'=> [
'en'=> ['title' => 'test title],
'ar' => 'title'=> 'test arabic title'
]
]);

it gives me unknonw column 'translations' ❗️

in PostTranslation model
i am using fillable= ['post_id', 'title']

this works ✅:
Post::create([
'user_id'=> $id,
'en'=> ['title' => 'test title],
'ar' => 'title'=> 'test arabic title'
]);

this doesn't work ❌:
Post::create([
'user_id'=> $id,
'translations'=> [
'en'=> ['title' => 'test title],
'ar' => 'title'=> 'test arabic title'
]
]);

i am using laravel 11

thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions