You don’t have to pass anything to blade. If you define your function, you can use it from blade.
- Create a new
app/helpers.phpfile. - Add your
trim_charactersfunction to it. - Add that file to your
composer.jsonfile. - Run
composer dump-autoload.
Now just use the function directly in blade:
{{ trim_characters($string) }}