Support the ongoing development of Laravel.io →
posted 4 years ago
Eloquent
Last updated 2 years ago.
0

Your query returns an array with an object.

Try accessing the first element of the array with [0] and get the variable (total) with [0]->total

DB::table("Machines")->select(DB::raw('(SUM(cantidad)*SUM(cantidad_actual)) as total'))->get()[0]->total

0

This page gives you a lot of information. Thank you!

Krunker io

0

Sign in to participate in this thread!

Eventy

Your banner here too?

hansel lesnah27 Joined 7 Mar 2020

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.

© 2024 Laravel.io - All rights reserved.