|
|
- <?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)->orderByRaw('RAND()')->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
- ]);
- }
-
- }
|