As the above question; Is there any way possible to use a where clause on a Collection?
These are my codes;
$order = \App\Order::where('user_id', $input['user_id'])
->whereBetween('created_at', array($date_from_formatted, $date_to_formatted))
->get();
Note that when i dd($order) my collection returns just fine
$online_order = $order->where('ord_type', 'Onl')
->where('paid', 'Y')
->whereIn('status', $param);
$online_order->all();
Note that when i dd($online_order) i get an empty collection
Am i doing something wrong with my $online_order?
make $order
to model instance so you can use where()
with it
$order = \App\Order::where('user_id', $input['user_id'])
->whereBetween('created_at', array($date_from_formatted, $date_to_formatted));
orderValue = $order->get();
and other
$online_order = $order->where('ord_type', 'Onl')
->where('paid', 'Y')
->whereIn('status', $param);
$online_order->all();
still the same mate
What error you'r getting.?
the collection returns an empty array,` Collection {#1255 ▼ #items: [] }`
you can debug but
toSql()
function insted ofget()
the value and run that sql to mysql and check