/** * Decode the given integer. * * @param int $value * * @return int */ public function decode($value) { return $this->obfuscator->decode($value); }
/** * @param int $orderId * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * * @return string */ public function viewAction(int $orderId) { /** @var Order $order */ $order = $this->orderResource->with(['orderItems.basketItem.productOption.product', 'address'])->findOrFail($this->optimus->decode($orderId)); return $this->webUi->view('customer.orders.view', compact('order')); }
/** * Update the specified resource in storage. * * @param Optimus $optimus * @param $number * @param $notificationId * * @return \Illuminate\Http\JsonResponse */ public function update(Optimus $optimus, $number, $notificationId) { $notificationId = $optimus->decode($notificationId); Notification::findOrFail($notificationId)->update(['received' => 1]); return $this->respondNoContent(); }
public function testDecodeBadStrings() { $this->setExpectedException('InvalidArgumentException'); $optimus = new Optimus(1580030173, 59260789); $optimus->decode("foo"); }