Support the ongoing development of →
posted 9 years ago
Views Packages
Last updated 2 years ago.

Try something like

public function getDurationAttribute()
    return $this->end->diffForHumans($this->start);

Then just access it using :


Beware of some edge cases (this code will fail if end is null).

Also you can use the Carbon documentation about dates comparaisons and differences:

Last updated 2 years ago.

Thanks atrakeur that was right on the money!

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

netm netm Joined 2 Apr 2014


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

Your logo here?

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

© 2024 - All rights reserved.