<?php

namespace App\Traits\Order;

use App\Models\OrderItem;
use Illuminate\Database\Eloquent\Collection;

trait WithOrderItem
{
    public function loadOrderItems(): Collection
    {
        return $this->items = OrderItem::query()
            ->currentUser()
            ->where('user_id', auth()->id())
            ->whereNull('order_id')
            ->latest()
            ->get();
    }
}
