validated() as $key => $item) $o->{$key} = $item; $o->active = (bool)$request->validated('active',FALSE); try { $o->save(); } catch (\Exception $e) { return redirect() ->back() ->withErrors($e->getMessage())->withInput(); } return $o->wasRecentlyCreated ? redirect() ->to('a/checkout/'.$o->id) ->with('success','Checkout added') : redirect() ->back() ->with('success','Checkout saved'); } public function cart_invoice(Request $request,Invoice $o=NULL) { if ($o) { $request->session()->put('invoice.cart.'.$o->id,$o->id); } if (! $request->session()->get('invoice.cart')) return redirect() ->to('u/home'); return view('theme.backend.adminlte.u.invoice.cart') ->with('invoices',Invoice::find(array_values($request->session()->get('invoice.cart')))); } public function fee(Request $request,Checkout $o): float { return $o->fee($request->post('total',0)); } public function pay(Request $request,Checkout $o) { return redirect('pay/paypal/authorise'); } }