23 lines
542 B
PHP
23 lines
542 B
PHP
<?php
|
|
|
|
namespace App\Domains\Purchase\Services\Checkout;
|
|
|
|
use App\Domains\Purchase\Models\Purchase;
|
|
|
|
class PurchaseResponseLoader
|
|
{
|
|
public function load(Purchase $purchase): Purchase
|
|
{
|
|
$relations = ['tenant', 'items.imageAttachment', 'stockReservation'];
|
|
|
|
if (
|
|
$purchase->status === Purchase::STATUS_IN_REVIEW
|
|
&& $purchase->payment_method === 'transfer'
|
|
) {
|
|
$relations[] = 'telepagosPaymentCandidates.payment';
|
|
}
|
|
|
|
return $purchase->load($relations);
|
|
}
|
|
}
|