I found the problem. If u're testing with postman, add X-Requested-With : XMLHttpRequest to headers and everything should work.
X-Requested-With : XMLHttpRequest