I have huge database model of around 1 million records, and on request I only want to get last 50 records from the database. Currently I do that by this
$models = Model::latest('id')->take(50)->get();
but when I look at debugbar, it shows 1 mil models were used, it also used a big amount of memory and rapidly slowed the request.
Is there any way of not storing whole database model into memory and just take those last records ?
