Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* Display a listing of the resource.
* @return \Illuminate\Http\Response
public function index()
$ventasConTotales = Venta::join("productos_vendidos", "productos_vendidos.id_venta", "=", "")
->select("ventas.*", DB::raw("sum(productos_vendidos.cantidad * productos_vendidos.precio) as total"))
->groupBy("", "ventas.created_at", "ventas.updated_at")
return view("ventas.ventas_index", ["ventas" => $ventasConTotales,]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment