Welcome Guest, Not a member yet? Register   Sign In
Using Codeigniter as RestAPI (using Axios)
#6

Hi, in my app i use this code:

PHP Code:
if ($this->request->getMethod() === 'patch')
  {

       $form $this->request->getPost();

       
$validation = \Config\Services::validation();

       
$rules = [
         
'password'     => "strong_password",
         
'pass_confirm' => 'matches[password]'
       
];

       
$validation->setRules($rules);

       if (
$validation->run($form) === FALSE)
       {

           return 
$this->failValidationError(json_encode($validation->getErrors()));

       }

       
// Omited code to save $model
        
       
return $this->respond(['status' => true'message' => $form]);
  } 


Check this article if it can help you, i need to add in my form to works.

https://codeigniter.com/user_guide/incom...ofing.html
Reply


Messages In This Thread
RE: Using Codeigniter as RestAPI (using Axios) - by nicojmb - 10-14-2020, 01:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB