get(); // Sesuaikan dengan logika pengambilan data $currentTimestamp = time(); // Get the current timestamp foreach ($orders as $order) { $createdAtTimestamp = strtotime($order->created_at); // Add 3 days to the creation date timestamp $expiryTimestamp = $createdAtTimestamp + (3 * 24 * 60 * 60); // 3 days in seconds // Compare the expiry timestamp with the current timestamp $isExpired = $expiryTimestamp < $currentTimestamp; $expired = $isExpired ? true : false; if($expired == true) { $findOrder = Payment::find($order->id); $findOrder->is_status = Status::isDepositCancel; // save $findOrder->save(); } } $this->info('Status updated successfully!'); } }