public function createReport() { try { $post_report = PostReport::wherePostId(Input::get('pid'))->whereUserId(Auth::user()->id)->whereReportId(Input::get('rid'))->first(); if ($post_report) { return 'false'; } $post_report = new PostReport(); $post_report->post_id = Input::get('pid'); $post_report->user_id = Auth::user()->id; $post_report->report_id = Input::get('rid'); if ($post_report->save()) { return 'true'; } else { return 'false'; } } catch (Exception $e) { return 'false'; } }