Support the ongoing development of Laravel.io →
Database Eloquent Forms
Last updated 2 years ago.
0

I'd start with seeing the output of this: console.log(mSubmittedSong.date_posted)

and then move on debugging output down the line.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0
Solution

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?

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

kronus kronus Joined 22 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.