I am using https://github.com/Astrotomic/laravel-translatable to make my models translatable.
While I am trying to update the model using below method to update the mode along with its associated translated content.
$product = $this->repository->update($input, $uuid);
// output of dd($input);
"uuid" => "44b26fb0-04b9-11eb-981a-6b01570d58ed"
"_method" => "PUT"
"en-us" => array:5 [▶]
"ar-eg" => array:5 [▶]
"account_uuid" => "a1c23ce0-04b7-11eb-b060-7faa78f23afd"
"type" => "tour"
"iso_4217" => "EGP"
"status" => "pending"
I got this error:
Column not found: 1054 Unknown column 'id' in 'where clause'
considering that the model primary key is "uuid" not "id" hence the foreign key is "product_uuid" not "product_id" as per below model setup.
class Product extends Model implements Transformable, TranslatableContract
{
public $incrementing = false;
public $keyType = 'string';
public $timestamps = true;
protected $primaryKey = 'uuid';
public $translatedAttributes = [
'name',
'quantity_label_snigular',
'quantity_label_plural',
'brief_description',
'long_description',
'terms',
'meta_keywords',
];
public $translationForeignKey = 'product_uuid';
public $localeKey = 'uuid';
public $useTranslationFallback = true;
}
I followed the exact documentation at this link https://docs.astrotomic.info/laravel-translatable/usage/forms#saving-the-request, although I am not able to trace that error.