mardi 27 juin 2017

How can i do to print a secuences of registers trying to get the registers from another table laravel 5.4

I have a table with indexes from another table, i want to print registers from the original table, this is my index function

public function index()
    {
        $id = Auth::user()->id;
        $mymatch = MyMatch::where('user_id', $id)->get();

        $matchs = array();
        foreach ($mymatch as $mymatchs) {
            $match = CreateMatch::where('id', $mymatchs->match_id)->value('id');
            $matchs[$match] = CreateMatch::find($match); 
        }


        $params = [
            'title' => 'My Matches',
            'mymatch' => $mymatch,
            'matchs' => $matchs,
        ];

        return view('user.mymatchs.mymatchs')->with($params);
    }

i tryied diferent things, thats the lastone, and my blade looks like this

@if(count($matchs)) 
@foreach ($matchs as $match)
         <tr>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                    <td>
                          <a href="" class="btn btn-danger btn-xs"><i class="fa fa-trash-o" title="Delete"></i> </a>
                          <a href="" class="btn btn-info btn-xs"><i class="fa fa-gamepad" title="Participants"></i> </a>
                          @if ($match[$match->id]->match_scores>0)
                          <a href="" class="btn btn-info btn-xs"><i class="fa fa-trophy" title="Scores"></i> </a>
                           @endif
                </td>
             </tr> 
@endforeach 
@endif



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

Aucun commentaire:

Enregistrer un commentaire