From 8f4764f9b6cd15e29b3b596dc9f7abd37837b89d Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Mon, 3 Jul 2023 21:15:43 -0400 Subject: [PATCH] Add helper function to the DashboardModel that converts line breaks to
s --- app/Models/DashboardModel.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Models/DashboardModel.php b/app/Models/DashboardModel.php index 2da2320..6489087 100644 --- a/app/Models/DashboardModel.php +++ b/app/Models/DashboardModel.php @@ -171,6 +171,16 @@ class DashboardModel extends Model } } + /** + * Convert line breaks to
s + * + * @return string + */ + public static function lineBreakToBr($string) + { + return preg_replace("/]*>/", "
", str_replace([ "\r\n", "\r", "\n" ], [ "", "", "" ], nl2br($string))); + } + /** * Find the desired image dimensions based on a maximum width and height *