Zemke/starter-laravel-angular

Sign Up or Sign In doesn't return a user object.

Closed this issue · 10 comments

Hi, I noticed on my local server, when ever i create a new user, the user object from the server is not returned. Same thing when I sign in or create a new todo item. After creating a todo item, i see undefined in the url /todos/view/undefined.
I'm pretty new to angularjs and I want to use this as starting point to learn angularjs + laravel.
Can someone help me out here, i don't know what to do?

Zemke commented

Are there any errors in the log?

No errors, it saves the details to the db quite alright. So i added console.log(res) to the $.save() method in TodoController. Please see the attached image for the output.
screen shot 2016-01-11 at 2 21 20 pm

can anyone help?

so look at db connection side and network logs to action on todos/
there can be an error but you cant see it.
Go to the Network - XHR - and look for result in Chrome DT

thank you for that suggestion @Aios. I did that and this was the result.

Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0
{"body":"adsfasdf dsa sd","updated_at":"2016-01-13 06:24:56","created_at":"2016-01-13 06:24:56","id":18}

So look at php.ini and change value of "always_populate_raw_post_data" to -1 and command to restart apache or nginx or php-fpm what are you use for server-side.

I would certainly recommend to upgrade to version 5.6 and use php-fpm + nginx connection.

Okay thank you @Aios. Will this also fix the warning message: "Warning: Cannot modify header information - headers already sent in Unknown on line 0"?

So that warning expect when some content string or something echoes or prints between user request and modify head. If you change always_populate_raw_post_data - it is likely that it will work.

Thank you very @Aios. Will let you know how it goes. I appreciate

Zemke commented

Yeah, adjusting always_populate_raw_post_data is also recommended by Laravel docs.