fix trigger bug 2

This commit is contained in:
2026-07-22 14:15:22 +03:30
parent 7d02639917
commit 8165fc37b8
6 changed files with 52 additions and 7 deletions
@@ -149,13 +149,17 @@ class ConditionalOrderController extends Controller
if (! empty($data['expires_at'])) {
try {
$expires = \Illuminate\Support\Carbon::parse($data['expires_at']);
$expires = \Illuminate\Support\Carbon::parse(
$data['expires_at'],
config('app.timezone')
)->timezone(config('app.timezone'));
} catch (\Throwable $e) {
throw new UnprocessableEntityHttpException('زمان اعتبار تاریخ معتبری نیست.');
}
if ($expires->lte(now())) {
throw new UnprocessableEntityHttpException('زمان اعتبار باید بعد از الان باشد.');
throw new UnprocessableEntityHttpException('زمان اعتبار باید بعد از تایم فعلی باشد.');
}
// Wall-clock in app TZ; column is DATETIME (not TIMESTAMP) to avoid double TZ shift.
$data['expires_at'] = $expires->format('Y-m-d H:i:s');
}