public static function getSearchIndexes() { //return eventname/media/hashtags $app = \Slim\Slim::getInstance(); $allGetVars = $app->request->get(); $startAt = @$allGetVars['startAt'] ? intval($allGetVars['startAt']) : 0; $count = \relive\models\SearchIndex::count(); if ($startAt >= $count) { echo json_encode([]); return; } $limit = $count - $startAt; $indexes = \relive\models\SearchIndex::select('event_id', 'eventName')->where('isPublished', '=', '1')->orderBy('event_id', 'desc')->skip($startAt)->take($limit)->get()->toArray(); echo json_encode($indexes, JSON_UNESCAPED_SLASHES); }
<?php require_once '/var/www/vendor/autoload.php'; if (isset($_GET['event_id'])) { $event = \relive\models\SearchIndex::find($_GET['event_id']); } if ($event) { $hashtags = \relive\models\Hashtag::whereIn('hashtag_id', function ($query) use($event) { $query->select('hashtag_id')->from('eventhashtagrelationships')->where('event_id', '=', $event->event_id); })->select('hashtag')->get(); $tags = []; foreach ($hashtags as $hashtag) { array_push($tags, $hashtag->hashtag); } $keyword = join(',', $tags); $posts = \relive\models\Post::whereIn('post_id', function ($query) use($event) { $query->select('post_id')->from('posteventrelationships')->where('event_id', '=', $event->event_id)->where('isFiltered', False); })->orderBy('datetime', 'desc')->offset(0)->limit(15)->get(); } else { header("Location: http://relive.space/"); } ?> <!DOCTYPE html> <html lang="en"> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb##"> <meta charset="UTF-8"> <title>relive</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <link rel="apple-touch-icon" sizes="57x57" href="//relive.space/apple-touch-icon-57x57.png">