Exemplo n.º 1
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']);
         }
     }
 }