/** * Handle Job. * * @param Client $client */ public function handle(Client $client) { try { $response = $client->get('http://mpeso.saldotuc.com/cards/' . $this->card->number . '/balance'); $responseParsed = json_decode($response->getBody(), true); $this->handleBalance($this->card, $responseParsed['balance']); } catch (ClientException $e) { if (Response::HTTP_NOT_FOUND == $e->getCode()) { $this->card->delete(); } } catch (\Exception $e) { Log::info(sprintf('Attempting to queue "request balance" for card %s after exception. Delayed execution for 2 seconds after (%d) attempts. Message: [%s] Exception class: [%s]', $this->card->number, $this->attempts(), $e->getMessage(), get_class($e))); $this->release(2); } }
/** * Remove the specified card from storage. * * @param Card $card * @return Response */ public function destroy(Card $card) { $card->delete(); return redirect()->route('admin.cards.index'); }