lundi 19 février 2018

Trying to skip duplicate values in Where for Laravel

I want to display all the teams for a year only once in Laravel. I can't get the distinct() to work because i'm not using a select(). How do I skip repeating values in where() or how do I include a variable with an array for select? I have also tried messing with "array_unique".

 public function showyear($id)
{

    $matchThese = [ 'homeWin' => '1', 'year'=>'2006'];



    $wins = GameData::where($matchThese)->distinct()->orderBy('team', 'asc')->get();



    $gamedatas = GameData::findOrFail($id);




    return view('games/showyear', compact('gamedatas', 'wins'));



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire