Пример #1
0
 /**
  * @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;
 }
Пример #2
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() }}