/** * @return \Illuminate\Http\RedirectResponse */ public function saveTee() { $competcategorie = Competcategorie::find(Input::get('id')); $competcategorie->tee_id = Input::get('tee_id'); $competcategorie->save(); return Redirect::route(Input::get('backUrl')); }
/** * @return mixed * Renvoie la comptcategorie du joueur : 0 si inconnu */ public function getCategorie() { $competCategorie = Competcategorie::with('categorie')->leftJoin('categories', 'competcategories.categorie_id', '=', 'categories.id')->select('competcategories.id')->where('categories.sexe_id', '=', $this->player->sexe_id)->where('categories.hcpmin', '<=', $this->hcp)->where('categories.hcpmax', '>=', $this->hcp)->where('categories.agemin', '<=', $this->player->age())->where('categories.agemax', '>=', $this->player->age())->first(); return $competCategorie ? $competCategorie->id : 0; }
{{ openContent('Eloquent') }} <?php $player = Player::find(1); $competCategorie = Competcategorie::with('categorie')->leftJoin('categories', 'competcategories.categorie_id', '=', 'categories.id')->select('competcategories.id')->where('categories.sexe_id', '=', $player->sexe_id)->first(); dd($competCategorie->id); ?> <p>Count = {{ $players->count() }}</p> @foreach($players as $player) {{ $player->nom }} | {{ $player->club->nom }} <hr> @endforeach {{ closeContent() }}
public function getListCategorieId() { // Liste des Categories deja selectionnees pour cette compet return Competcategorie::whereCompetId($this->id)->lists('categorie_id'); }