dimanche 27 novembre 2016

Laravel can not store array in session

MyController

$reviewComment = [];
foreach($comments as $key=>$comment){
  $reviewComment[$key][0] = $comment->comment_name;
  $reviewComment[$key][1] = $comment->user->corporation;
  $reviewComment[$key][2] = $comment->comment;
  $reviewComment[$key][3] = $comment->created_at;
}

session(['reviewComment'=> $reviewComment]);
return redirect()->back();

so reviewComment doesn't appear in view I also using this

return redirect()->back()->with('reviewComment', $reviewComment]);

but doesn't work

and something strange when size of $reviewComment is [4] or less than 4. it can appear but more than that doesn't.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire