Support the ongoing development of Laravel.io →
Database Eloquent
select * from `prices` where `prices`.`item_id` in ('1', '2', '3') and `created_at` <= '2014-06-20 22:26:58' order by `created_at` desc limit 3

i will receive this query with

function ($query) {
    $query->where('created_at', '<=', Carbon::now())->latest()->take($limit);
}

i want $limit variable equals to count ('1', '2', '3'), for now its 3 but how i can use $query to count this?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

samsoft samsoft Joined 15 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.