here is my route.php
Route::post('users' , array('uses' => 'Userscontroller@index'));
This is my Userscontroller.php
public function index()
{
$email_id = Input::get('email_id');
$name = Input::get('name');
return $email_id. ' ' .$name;
}
When i run this in postman I get error as
'>' unexpected in JSON
.
Where m I missing?
Thank You.
if you send json like this:
{"user":{"name":"abc","code":134}}
in laravel controller:
$data = $request->json()->all(); //read json in request
return response()->json($data); //send json respond
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With