dd($request->all()); gives back empty array

Found the answer - looks like there was an issue with my headers in Postman. I had both Accept application/json and Content-Type application/json. Once I removed Content-Type, all is fixed. Thanks!


Bit late to the party, but might be usefull for others: My problem was that the Content-Type header value was application/json while the actual payload was form data. Changing the header to application/x-www-form-urlencoded fixed the issue.


Just want to add where i made a mistake. When sending POST request with Postman, you also have to make sure the json is correct.

// invalid json (notice the ending comma)
{
    "akey":"aval",
    "nkey": "bval",
}

//valid json (no ending comma)
{
    "akey":"aval",
    "nkey": "bval"
}

Tags:

Php

Laravel