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

Reading the documentation, $this->validate() will validate the input data based on the request type. So if you have a GET request, it will validate the $_GET data. If you have a POST (or PUT?) request, it will validate the $_POST data.

This seems to happen transparently. You simply use the $this->validate() call as a gateway to control the flow. You don't need to see the data at this point, only set up your validation rules that must pass.

Read about this here:
http://codeigniter.com/user_guide/incomi...ating-data

The boolean logic would be:
  • If validation passes, do something.
  • If validation fails, do something else.


If you need access to the request data after the validation runs, you can call $this->request->getPost(), for example.

Read about that here:
http://codeigniter.com/user_guide/incomi...quest.html#
Reply


Messages In This Thread
RE: Using Codeigniter as RestAPI (using Axios) - by connectgrid - 10-13-2020, 06:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB