45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Http\Controllers\Kasir\PrintOutController;
|
|
use App\Models\Pesanan;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class ProcessPrint implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
protected $pesanan;
|
|
/**
|
|
* Create a new job instance.
|
|
*/
|
|
public function __construct(Pesanan $pesanan)
|
|
{
|
|
$this->pesanan = $pesanan;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
try {
|
|
$pesanan = Pesanan::find($this->pesanan->id);
|
|
Log::error('Printing: ' . $pesanan->id);
|
|
$print = new PrintOutController();
|
|
|
|
$print->print($pesanan->id);
|
|
Log::error('Printed: ' . $pesanan->id);
|
|
} catch (\Throwable $th) {
|
|
//throw $th;
|
|
Log::error($th->getMessage());
|
|
}
|
|
}
|
|
}
|