diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 85c1ecc9..8087018e 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -66,13 +66,13 @@ class EmailDoToVTCommand extends Command $zip = new ZipArchive(); if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) { - echo 'yes'; + $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', Carbon::yesterday()) ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 2); })->get(); - if(!$bookings){ return; } + if(!count($bookings)){ return; } foreach ($bookings as $booking) { $file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();