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

  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use DB;
  5. use App\Tweet, App\Team;
  6. class SlideshowController extends Controller
  7. {
  8. public function slideshow() {
  9. $photos = [];
  10. $tweets = Tweet::where('processed', 1)->inRandomOrder()->get();
  11. foreach($tweets as $tweet) {
  12. if($tweet->photo) {
  13. foreach(json_decode($tweet->photo) as $photo) {
  14. $photos[] = [
  15. 'img' => $photo,
  16. 'description' => $tweet->team->name . ' Team: ' . $tweet->text
  17. ];
  18. }
  19. }
  20. }
  21. return view('slideshow', [
  22. 'photos' => $photos
  23. ]);
  24. }
  25. }