Support the ongoing development of →
Database Eloquent
Last updated 2 years ago.

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...
Last updated 2 years ago.

Why you are not using



Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

Metrakit metrakit Joined 25 May 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.