inRandomOrder()->get(); foreach($tweets as $tweet) { if($tweet->photo) { foreach(json_decode($tweet->photo) as $photo) { $photos[] = [ 'img' => $photo, 'description' => ($tweet->team ? $tweet->team->name . ' Team: ' : '') . $tweet->text ]; } } } return view('slideshow', [ 'photos' => $photos ]); } }