Storing dates with Laravel

4.8k views Asked by At

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"

1

There are 1 answers

0
cheese5505 On BEST ANSWER

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!