diffForHumans在Laravel的常规日期

So on my website, I want to be able to tell when a job is due.

I can print the date just fine,

<p>Due in: {{ $active_commission->estimated_date }}</p>

will give me "Due in: 2017-04-28" for example.

Now, that's cool and all, but I would rather it say something like: "8 days from now".

Elsewhere on my site, I use diffForHumans for a similar effect:

<p>Created:{{ $quotes->created_at->diffForHumans() }}</p>

will give me something like "Created: 3 days ago."

Which is great. However, diffForHumans seems to only work on timestamps, whereas I'm using a date.

What could I use to make this work?

You can parse the date to create a Carbon instance:

{{ Carbon::parse($active_commission->estimated_date)->diffForHumans() }}

But a better way is to add estimated_date to the $dates property so Eloquent would automatically make it a Carbon instance. In this case, you'll be able to do this:

{{ $active_commission->estimated_date->diffForHumans() }}