FleetCart/Modules/Tax/Http/Controllers/CartTaxController.php

32 lines
711 B
PHP
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?php
namespace Modules\Tax\Http\Controllers;
use Illuminate\Http\Request;
use Modules\Cart\Facades\Cart;
class CartTaxController
{
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->mergeShippingAddress($request);
Cart::addTaxes($request);
return Cart::instance();
}
private function mergeShippingAddress($request)
{
$request->merge([
'shipping' => $request->ship_to_a_different_address ? $request->shipping : $request->billing,
]);
}
}