exists) $o = Auth::user(); return View('u.home',['o'=>$o]); } /** * Render a specific invoice for the user * * @param Invoice $o * @return View */ public function invoice(Invoice $o): View { return View('u.invoice.home',['o'=>$o]); } /** * Return the invoice in PDF format, ready to download * * @param Invoice $o * @return mixed */ public function invoice_pdf(Invoice $o) { return PDF::loadView('u.invoice.home',['o'=>$o])->stream(sprintf('%s.pdf',$o->sid)); } /** * Enable the user to down an invoice by providing a link in email * * @param Invoice $o * @param string $code * @return \Illuminate\Http\RedirectResponse|mixed */ public function invoice_pdf_email(Invoice $o,string $code) { try { Doorman::redeem($code,$o->account->user->email); } catch (ExpiredInviteCode $e) { Log::alert(sprintf('User is using an expired token for invoice [%s] using [%s]',$o->id,$code)); return redirect()->to('/login'); } catch (DoormanException $e) { Log::alert(sprintf('An attempt to read invoice id [%s] using [%s]',$o->id,$code)); abort(404); } return $this->invoice($o); } /** * Return details on the users service * * @param Service $o * @return View */ public function service(Service $o): View { $breadcrumb = collect(); $breadcrumb->put($o->account->user->full_name,url('u/home',$o->account->user_id)); return View('u.service.home') ->with('breadcrumb',$breadcrumb) ->with('o',$o); } /** * Progress the order to the next stage * * @note: Route Middleware protects this path * @param Service $o * @param string $status * @return \Illuminate\Http\RedirectResponse * @deprecated */ public function service_progress(Service $o,string $status) { return redirect()->to($o->action($status) ?: url('u/service',$o->id)); } }