2022-11-01 11:24:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Jobs;
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
2022-11-02 10:20:02 +00:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2022-11-01 11:24:36 +00:00
|
|
|
|
|
|
|
use App\Classes\FTN\Tic;
|
|
|
|
|
|
|
|
class TicProcess implements ShouldQueue
|
|
|
|
{
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
|
|
|
|
private const LOGKEY = 'JTP';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new job instance.
|
|
|
|
*
|
|
|
|
* @param string $file
|
|
|
|
*/
|
|
|
|
public function __construct(private string $file)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* @throws FileNotFoundException
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2022-11-02 10:20:02 +00:00
|
|
|
$to = new Tic($this->file);
|
|
|
|
|
|
|
|
Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id));
|
|
|
|
|
2022-11-03 11:05:49 +00:00
|
|
|
unlink($this->file);
|
2022-11-01 11:24:36 +00:00
|
|
|
}
|
|
|
|
}
|