cheese5505
cheese5505

Reputation: 982

Storing dates with Laravel

I am trying to store a date with Laravel. I have a timestamp field (but I have tried with a date field with the same issue) and whenever I try to store a date with the format dd-mm-yyyy it stores date: "0000-00-00 00:00:00". Here is how I am storing the date:

$result = new Result();
$result->date = Carbon::parse(Request::input('date'));

(along with all the over vars and $result->save();)

I have the date field in my $dates variable in my Result model.

If anyone could tell me why it does this it would be awesome!

Thanks

Edit: When I do var_dump on Request::input('date') I get string(10) "15-06-2015"

Upvotes: 3

Views: 5017

Answers (1)

cheese5505
cheese5505

Reputation: 982

Even though I put the date field in my $dates field in my Model, I took it out of my $fillable. Thanks for everyones help!

Upvotes: 2

Related Questions