Guest User

Untitled

a guest
Jan 19th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. public function delete () {
  2.  
  3. if( isset($_POST) && !empty($_POST) ) {
  4.  
  5. $Validator = new Validator;
  6. $Validator->validation_rules(array(
  7. 'id' => 'required|numeric',
  8. ));
  9.  
  10. $validated = $Validator->run($_POST, true);
  11. if($validated === false) {
  12. echo helperModel::toJson(
  13. array(
  14. 'success'=>0,
  15. 'message'=>$Validator->get_readable_errors(true)
  16. ));
  17. } else {
  18. $delete_contact = (new contactModel)->delete($validated['id']);
  19. if($delete_contact){
  20. echo helperModel::toJson(array('success'=>1));
  21. }
  22. }
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment