Astrotomic / laravel-translatable

A Laravel package for multilingual models
https://docs.astrotomic.info/laravel-translatable/
MIT License
1.23k stars 155 forks source link

Being able to access the translations from the UpdateOrCreate method #274

Open cris-alteregoweb opened 2 years ago

cris-alteregoweb commented 2 years ago

It would be nice to be able to access the translations in the condition of the updateOrCreate method just like when using it when doing insert. Something like that:

Model::updateOrCreate([ 'model_id' => $model->id, 'es' => [ 'section' => 'Ejemplo', 'title' => 'Ejemplo documento ', 'doc' => 'documento.pdf', ], ], [ 'model_id' => $model->id, 'es' => [ 'section' => 'Ejemplo', 'title' => 'Ejemplo documento', 'doc' => 'documento_es.pdf', ], 'en' => [ 'section' => 'Example', 'title' => 'Example document', 'doc' => 'document_en.pdf', ], ]);

I find myself in this problem and I thought it was a good idea to propose it.