Zemke / starter-laravel-angular

Laravel and AngularJS Starter Application Boilerplate featuring Laravel 5.3 and AngularJS 1.5.8
https://starter-laravel-angular.herokuapp.com
Other
369 stars 119 forks source link

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

Closed elsopi closed 7 years ago

elsopi commented 8 years ago

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 8 years ago

Are there any errors in the log?

elsopi commented 8 years ago

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

elsopi commented 8 years ago

can anyone help?

ghost commented 8 years ago

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

elsopi commented 8 years ago

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}

ghost commented 8 years ago

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.

elsopi commented 8 years ago

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

ghost commented 8 years ago

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.

elsopi commented 8 years ago

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

Zemke commented 7 years ago

Yeah, adjusting always_populate_raw_post_data is also recommended by Laravel docs.