public function destroy($id)
 {
     if (is_numeric($id)) {
         $projectComment = ProjectComment::findOrFail($id);
         $projectComment->delete();
         return response()->json(['success' => 'Successfully deleted']);
     } else {
         abort('The required parameters are missing or invalid', 500);
     }
 }
Example #2
0
 function getBlockpost()
 {
     $startDate = date("Y-m-d H:i:s");
     $endDate = date("Y-m-d H:i:s", strtotime('-24 hours'));
     $unsafeDetails = Unsafe::where('notified', '1')->where('status', '1')->where('updated_at', '>=', $endDate)->get();
     //dd($unsafeDetails);
     for ($i = 0; $i < count($unsafeDetails); $i++) {
         $id = $unsafeDetails[$i]['id'];
         $type = $unsafeDetails[$i]['type'];
         $post_id = $unsafeDetails[$i]['post_id'];
         $user_id = $unsafeDetails[$i]['user_id'];
         if ($type == "comments") {
             $blockComment = ProjectComment::where('id', '=', $post_id)->where('user_id', $user_id)->update(array('status' => '2'));
         }
         if ($type == "updates") {
             $blockUpdate = ProjectUpdates::where('id', '=', $post_id)->where('user_id', $user_id)->update(array('status' => '2'));
         }
         $update = Unsafe::where('id', '=', $id)->update(array('notified' => '4'));
     }
 }