How to add a \n in SMS? Hello!
I'm trying to get the grip around SMS notifications in Laravel, one thing I don't seem to be able to be adding a new line, I've tried to use the \n and %0D%0A to achieve this, however, it adds it to the content, instead of a new line.
Any clues on how it works?
How are you passing your string to the notification?
@Snapey
/**
* Get the Vonage / SMS representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\VonageMessage
*/
public function toVonage($notifiable)
{
return (new VonageMessage)
->clientReference((string) $notifiable->id)
->content('Ny opgave tildelt \n Kunde: sdfsdf %0D%0A Adresse: sdfsdf %0D%0A Opgave: sdfsdf %0D%0A Tid: sdfsdf %0D%0A Godstype: sdf');
}
Be sure to use " instead of ' to have php parse it as a newline
@Sinnbeck I'm not really sure what you're suggesting, would you be able to elaborate on it?
@Foks sure. Example
'this wont \n work'
"this \n will"
@Sinnbeck Thank you, I wasn't aware that the single quotes and double quotes mattered.
@Foks for linebreaks and variables in text it does :)
Please sign in or create an account to participate in this conversation.