osb/app/Http/Controllers/CheckoutController.php
2020-07-27 14:49:59 +10:00

34 lines
737 B
PHP

<?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');
}
}