Suppose i have this type of input for product
//json
{
"name": {
"en": "This is name in English",
"bn": "This is name in Bangla",
},
}
now i want to use mutator for generate unique slug based on english name
I'm trying like this
public function setNameAttribute($value)
{
// Generate and set the unique slug
$this->attributes['slug'] = $this->generateUniqueSlug($value);
}
As far as I understand if you have array of inputs , you should use key to get value. i hope this help you :