How to make a LIMIT in Laravel?

1

I need to show a certain amount of values in a view.

I want to do something like SELECT * FROM tabla LIMIT 4

But I need to do it in Laravel

    
asked by Luis Morales 03.10.2016 в 20:33
source

1 answer

2

The take () method of the Query Builder is the one that fulfills this function:

$resultado = DB::table('tabla')->take(4)->get();

As you can always see more info in the Laravel documentation: link

You can also see what this method does in the framework code: link

    
answered by 03.10.2016 / 20:38
source