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 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(); }

How it is possible to access from the controller in this case with where?

Still learning on of laravel and Eloquent based such things



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire