4 months ago

Can't import slug to database when attribute have special characters

Posted 4 months ago by untymage

I have set up this mutator in my model :

public function setSlugAttribute($value)

    return $this->attributes['slug'] = ucwords(Str::slug($value), '-');


When the attribute have special character it prevent to persist the value to the database, For example if the value equal to this : & % test valie $ mutator will ignore and replace it with white space i think ...

Please sign in or create an account to participate in this conversation.