I don't know if I'm not holding my toungue right or something, but I'm trying to get a total in the table footer. I have no doubt there is something I'm missing, here is what I tried:
$labors = Labor::where('created_at', '>=', new DateTime('today'))->get()->sum('labor');
Which works well up until here:
->sum('labor')
Then I get:
Call to undefined method Illuminate\Database\Eloquent\Collection::sum()
So I'm obviously using it incorrectly because it's in the docs here:
http://four.laravel.com/docs/queries
Some feedback would be much appreciated. :)
I think this might actually be relevant:
public function index()
{
$labors = Labor::where('created_at', '>=', new DateTime('today'))->sum('labor');
return View::make('labors.index', compact('labors'));
}