3 months ago

Complex substitution in blade ...

Posted 3 months ago by MartinW12

I have a database field that contains an address as multi-line text.

To display it I currently use:

{!! str_replace("\n", '', e($address)) !!}

Which works, but is a bit messy - is there a better way of doing this that is also intuitive?

I know I could create a new blade directive, something like "@multiline($address)" but I don't really like that because it's not really intuitive.

What I would like is to be able to define is something like "{## $address ##}" - is that possible at all?

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