osb/app/Http/Controllers/CheckoutController.php

34 lines
737 B
PHP
Raw Permalink Normal View History

2020-07-27 04:49:59 +00:00
<?php
namespace App\Http\Controllers;
use App\Models\Invoice;
use Illuminate\Http\Request;
use App\Models\Checkout;
class CheckoutController extends Controller
{
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('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');
}
}