how to pass many variables from the controller to the view in laravel

0

I want to pass these variables, but it seems that quantity prevents me, is there another way?

        return view('pontuacao')->with('somas', $somas[0]->p)->with('somas1', $somas1[0]->s)->with('palpites', $palpites)->with('confrontos', $confrontos)->with('ranking', $ranking)->with('somas2', $somas2[0]->s)->with('somas3', $somas3[0]->s)->with('somas4', $somas4[0]->s)->with('somas5', $somas5[0]->s)->with('somas6', $somas6[0]->s);
    
asked by anonymous 29.10.2017 / 20:37

1 answer

0

You can put all the data in 1 array and return the array:

$ data = array (     'sums' = > $ sums [0] -> p,     'somas1' = > $ somas1 [0] - > s,     '...' = > '...' ); return view ('punctuation') -> with ('data', $ data);

or, pass variable by variable outside with () :

return view ('punctuation', 'sums' => sums [0] -> p, 'sums1' => $ sums1 [0] -> '= >' ... ']);

Test there and return what you chose! : D

Save from ZoyO !

    
30.10.2017 / 11:45