Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

777not888's avatar

How do I cut too long text on a resource index page?

It should look something like this

id | movie | description

1 | Name | The beginning of a very long description ...

0 likes
2 replies
tykus's avatar

The words string method will truncate a sentence after a given number of words

Str::words($str, $numWords);
Torpedo's avatar

you can do this like this...

            Text::make('Name', 'name')->displayUsing(function ($value) {
                return str_limit($value, '20', '...');
            }),

Please or to participate in this conversation.