You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
623 B

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\Tweet, App\Team;
class SlideshowController extends Controller
{
public function slideshow() {
$photos = [];
$tweets = Tweet::where('processed', 1)->inRandomOrder()->get();
foreach($tweets as $tweet) {
if($tweet->photo) {
foreach(json_decode($tweet->photo) as $photo) {
$photos[] = [
'img' => $photo,
'description' => $tweet->team->name . ' Team: ' . $tweet->text
];
}
}
}
return view('slideshow', [
'photos' => $photos
]);
}
}