samedi 27 février 2016

Missing argument in Laravel 5 with Eloquent

At the moment I'm working on a statistic part of my cms about Formula 1.

My queries I have in my Model and want to access them from the controller.

That's my query from the Controller:

$maxlaps = Statistic::with('maxLapsTotal')->where('test_id', $id)->first();

That's my query in my Model.

public function maxLapsTotal($testdays)
{
    return $this->select(DB::raw('sum(laps) as laps'))
                ->where('test_id', $testdays)
                ->groupBy('driver_id')
                ->limit(1)->orderBy('laps', 'DESC')->first();
}

In this case, how is it possible to access from the controller using where?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TJG41H
via IFTTT

Aucun commentaire:

Enregistrer un commentaire