I have this code:
href="#0">{{$article->title,}}
How do I limit the title to certain characters with "..." at the end?
Thank you!
I have this code:
href="#0">{{$article->title,}}
How do I limit the title to certain characters with "..." at the end?
Thank you!
 
    
    You can use 2 methods to do this:
Method 1:
 //I am assuming that you need to print first 20 characters from the title
 {{ substr($article->title, 0,  20) }}
Method 2:
 {{ Illuminate\Support\Str::limit($article->title, 20) }}
 
    
    Laravel provides a function for this specific usage:
{{ Str::limit($article->title, 100, '...') }}
100 is the number of characters to keep,
... is the string to append after truncating
 
    
    You can use substr(); https://www.w3schools.com/php/func_string_substr.asp
{{substr("Hello world",0,25)}}...
