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!
The Laravel portal for problem solving, knowledge sharing and community building.
The community