I'd start with seeing the output of this: console.log(mSubmittedSong.date_posted)
and then move on debugging output down the line.
Yes, it is outputting the correct date, which I entered "2014:11:26 10:22:00"
Do think that it had to with the fact that I created the db on the mysql command line - source songs.sql
Instead of doing something like this - php artisan migrate:make songs?
Which leads to another question, do I have something in my up function?
Schema::create('songs', function($table) { $table->increments('id'); $table->string('title'); ... $table->date('date_posted'); });
Would this have anything to do with the error? That is to say, creating the db and filling the table from outside of Laravel?
Thanks for replying, I am a newbie at Laravel and I would like to understand everything.
szegad said:
I'd start with seeing the output of this: console.log(mSubmittedSong.date_posted)
and then move on debugging output down the line.
Try do this instead?
save : function(songData) {
return $http({
method: 'POST',
url: '/api/songs',
headers: { 'Content-Type' : 'application/x-www-form-urlencoded' },
data: $.param(songData)
});
}
Or might be try to do application/json as your content-type and do Input::json() instead?
Maybe you could try posting data from angular to some fake url where you can just print them and make sure that angular is posting the data right (printr_r($_POST). Then maybe it's something about your routing / model binding - I mean Input is empty.
OMG - it was the $.param(songData) which made it work.
Thank you, thank you, thank you.
awsp said:
Try do this instead?
save : function(songData) { return $http({ method: 'POST', url: '/api/songs', headers: { 'Content-Type' : 'application/x-www-form-urlencoded' }, data: $.param(songData) }); }
Or might be try to do application/json as your content-type and do Input::json() instead?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community