I am using Laravel-5.8 for a web application project.
In the Project, I used text editor for a particular field called goal_description and the datatype is longtext.
public function index()
{
$goals = Goal::all();
return view('goals.index')->with('goals', $goals);
}
<tbody>
@foreach($goals as $key => $goal)
<td>
{{$key+1}}
</td>
<td>
{{$goal->goal_title ?? '' }}
</td>
<td>
{{$goal->goal_description ?? '' }}
</td>
@endforeach
</tbody>
I have two issues:
How do I display goal_description without the HTML tags, but it will format the field
How do I truncate the field to the length of 20 with ellpse ..., then when the ellipse is clicked, it will display everything.
Thank you.
Issue 1> use
{!!$goal->goal_description ?? '' !!}
Issue 2> I really dont know what ellipse is. But to truncate a string just use str as below
{!! Str::limit($goal->goal_description, 20, ' ...') !!}