Ejemplo n.º 1
0
 }
 if (isset($_GET['post_id'])) {
     if (isset($_GET['filter'])) {
         $post = \relive\models\PostEventRelationship::whereIn('post_id', function ($query) {
             $query->select('post_id')->from('reports')->where('post_id', '=', $_GET['post_id']);
         })->first();
         $post->isFiltered = 1;
         $post->save();
         $report = \relive\models\Report::where('post_id', '=', $_GET['post_id'])->get();
         foreach ($report as $rep) {
             $rep->isSettled = 1;
             $rep->save();
         }
     } else {
         if (isset($_GET['settle'])) {
             $report = \relive\models\Report::where('post_id', '=', $_GET['post_id'])->get();
             foreach ($report as $rep) {
                 $rep->isSettled = 1;
                 $rep->save();
             }
         }
     }
 }
 if (isset($_GET['updateevent'])) {
     $event_id = $_GET['event_id'];
     $event = \relive\models\Event::find($event_id);
     $event->eventName = $_GET['eventName'];
     $event->startDate = strtotime($_GET['startDate']);
     $event->endDate = strtotime($_GET['endDate']);
     $event->save();
     \relive\models\EventHashtagRelationship::where('event_id', '=', $event_id)->delete();
Ejemplo n.º 2
0
 public static function reportPostFromEvent($event_id)
 {
     $app = \Slim\Slim::getInstance();
     $allPostVars = $app->request->post();
     $post_id = @$allPostVars['post_id'] ? $allPostVars['post_id'] : -1;
     if (isset($post_id) && $post_id != -1) {
         try {
             $relationship = \relive\models\PostEventRelationship::where('event_id', '=', $event_id)->where('post_id', '=', $post_id)->firstOrFail();
             $report = \relive\models\Report::create(['report_time' => time(), 'post_id' => $post_id]);
             echo json_encode($report, JSON_UNESCAPED_SLASHES);
         } catch (ModelNotFoundException $e) {
             $app->render(404, ['Status' => 'Relationship not found']);
         }
     }
 }