Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

Why not just use Carbon to do this?

Carbon::now()->addMonths(2);
Last updated 1 year ago.
0

When i use this method in laravel 4, there is a class not found error

Last updated 1 year ago.
0

soclosed said:

When i use this method in laravel 4, there is a class not found error

You need a use statement at the top of your class:

use Carbon\Carbon;
Last updated 1 year ago.
0

I heard that in laravel 4.1, carbon was already. It's wrong ?

Last updated 1 year ago.
0

Carbon is included with Laravel 4.1, but to use it you need to have use Carbon\Carbon at the top of your file.

Last updated 1 year ago.
0

Read about namespaces, too.

Last updated 1 year ago.
0

Ok, great, thanks !

Last updated 1 year ago.
0

I tried this, but it didn't add two month at the current. It still the current date insert in MySQL

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

soclosed soclosed Joined 5 Feb 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.