This doesn't have anything to do with Eloquent. You should extract this replacement behaviour to its own dedicated class. The way you are using
str_replace is so unmaintainable. Maybe you could use a hash array, at least it would be much easier to read and update later.
$replacements = [ '-' => '', '!' => '', // etc... ];
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us