How to do "read more or read less" concept for tinymce Editor content in Laravel blade file

Viewed 86

i am using a tinymce editor for inserting content into the database which stores the data along with the html tags and i want to add read more or read less concept to Laravel blade file. is any methods or technique is there in Laravel 8.

I have tried {!! Str::words($value->blog_content, 8, ' readmore >>>') !!} but it doesn't consider the html tags, so UI was collapsed.

1 Answers

You can strip the tags before call the words function

{!! Str::words(strip_tags($value->blog_content), 8, ' readmore >>>') !!}

Related