Skip to content

Commit

Permalink
Closes #50
Browse files Browse the repository at this point in the history
  • Loading branch information
csavelief committed Jul 30, 2024
1 parent 34b4541 commit 1016371
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Http/Controllers/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Http\Requests\CheckoutRequest;
use App\Models\Billpayer;
use App\Models\TaxRate;
use App\User;
use Illuminate\Support\Facades\Auth;
use Konekt\Address\Models\CountryProxy;
use Vanilo\Cart\Contracts\CartManager;
Expand Down Expand Up @@ -34,6 +35,7 @@ public function __construct(Checkout $checkout, CartManager $cart)
public function show()
{
$checkout = false;
/** @var User $user */
$user = Auth::user();

if ($this->cart->isNotEmpty()) {
Expand All @@ -47,8 +49,9 @@ public function show()
if ($user) {

$lastOrder = Order::select('orders.*')
->join('users', 'users.id', '=', 'orders.created_by')
->join('users', 'users.id', '=', 'orders.user_id')
->where('users.tenant_id', $user->tenant_id)
->whereRaw($user->customer_id ? "users.customer_id = {$user->customer_id}" : "1=1")
->orderBy('orders.created_at', 'desc')
->first();

Expand Down

0 comments on commit 1016371

Please sign in to comment.