Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

darrenchan's avatar

PHP Carbon not working as expected.

I have a extra column called birthday.

Now I want to show diffForHumans() on that column. But when I try, it shows me error. Any solution?

1 like
2 replies
tisuchi's avatar
tisuchi
Best Answer
Level 70

Normally you need to define a new column in your model.

For example-

ModelName extends Model{
    public $dates = ['brithday'];

    ...

Now you can call diffForHumans.

4 likes

Please or to participate in this conversation.