kpd = $kpd; $this->name = $name; $this->item = $item; } /** * Execute the job. * * @return void */ public function handle() { $compound = Compound::with('ConfidentialFile')->where('kpd', $this->kpd)->first(); $client = new \GuzzleHttp\Client(); $result = $client->request('POST', 'http://filegoforce.sipadu.my/api/generate/barcode', [ 'verify' => false, 'form_params' => [ 'barcode' => $this->name, 'no_siri' => $compound->ConfidentialFile->no_siri, 'type' => 'proxy', ] ]); $response = json_decode($result->getBody()->getContents()); if($response->success == true){ $barcode = new Barcode(); $barcode->barcode_id = $this->name; $barcode->path = $response->data; $barcode->status = 'simpan'; $this->item->barcode()->save($barcode); } } }