i need to add up all the money in the column "ingresos".
error: Property [presupuesto] does not exist on this collection instance.
used the variable : {{ $contador->presupuesto->count() }}
database:
controller:
public function contador(){
if (Auth::guest())
return redirect('/login');
$contador = \App\Models\Registro::All();
return view('contador',compact('contador'));
}
I need to add the income
You count the values, but you have to add them . To calculate the sum of values, use:
$contador->sum('presupuesto');