You can try this if you want date time string: It Produces something like "2019-03-11 12:25:00"
use Carbon\Carbon; $current_date_time = Carbon::now()->toDateTimeString();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
redeem_by optional
Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer be applied to new customers.
Stripe has a few attributes on their coupon object. Two are the created and redeem_by.
Is there a simple way to set the migration?
Something similar to:
$table->timestamps();
Thank you ~
Thanks again for having a look. It got me thinking a little deeper. Hope you can use this:
error:
Symfony\Component\ErrorHandler\Error\FatalError Access level to App\Models\Coupon::getDateFormat() must be public (as in class Illuminate\Database\Eloquent\Model)
I found this was less work and more direct:
//Controller
//validation
$createdUnix = Carbon::now()->timestamp;
//then..
$coupon = Coupon::create([
...
'created' => $createdUnix,
...
]);
Please or to participate in this conversation.