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);
    }


New contributor

Nafis Chonchol is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.