Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display only a part of a string in laravel 5.2?

I have a description field with more than 100 words,but I need to show only 10 characters on my blade. How can I do this?

like image 931
Helena Hannah George Avatar asked May 09 '17 05:05

Helena Hannah George


2 Answers

use str_limit, refer to this post

{{ str_limit($string, $limit = 10, $end = '...') }}
like image 170
LF00 Avatar answered Oct 10 '22 02:10

LF00


You can show a part (first 10 characters) of a string using

{{substr($myStr, 0, 10)}}

in laravel blade template.

like image 28
Shakti Phartiyal Avatar answered Oct 10 '22 01:10

Shakti Phartiyal