Update (list): Fix crash on list output
This commit is contained in:
@@ -2,6 +2,22 @@
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
if (! function_exists('str_first_sentence')) {
|
||||
function str_first_sentence($str) {
|
||||
// Split the string at ., !, or ?
|
||||
$sentences = preg_split('/(\.|!|\?)(\s|$)/', $str, 2);
|
||||
|
||||
// Return the first part of the array if available
|
||||
if (isset($sentences[0])) {
|
||||
return trim($sentences[0]);
|
||||
}
|
||||
|
||||
// If no sentence ending found, return the whole string
|
||||
return $str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (! function_exists('is_empty')) {
|
||||
/**
|
||||
* A better function to check if a value is empty or null. Strings, arrays, and Objects are supported.
|
||||
|
||||
Reference in New Issue
Block a user