mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-20 21:13:59 +00:00
27 lines
810 B
PHP
27 lines
810 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Services;
|
|
|
|
|
|
use App\Classes\ValueObjects\Constants\BusinessType;
|
|
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
|
use App\Http\Resources\CompanyResource;
|
|
use App\Http\Resources\CurrencyResource;
|
|
use App\Models\Currency;
|
|
use App\Models\SegmentConstant;
|
|
|
|
class AddCurrenciesResourceToSupplierCompany
|
|
{
|
|
|
|
public function execute(CompanyResource $company){
|
|
|
|
if($company->business_type === BusinessType::CURRENCY_VENDOR){
|
|
$segment = SegmentConstant::where('reference', SegmentConstants::SUPPLIER_CURRENCIES)->where('detail->id', $company->id)->first();
|
|
|
|
return ['currencies' => CurrencyResource::collection($segment ? Currency::whereIn('id', $segment->detail->currencies)->get() : [])];
|
|
}
|
|
|
|
return [];
|
|
}
|
|
|
|
} |