mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-20 13:04:11 +00:00
05b1aedda5
# Conflicts: # app/Classes/Modules/Announcements/DataTransferObjects/AnnouncementObject.php # app/Classes/Modules/Segments/ControllersLogic/CreateSegmentLogic.php # app/Classes/Modules/Segments/ControllersLogic/DeleteSegmentLogic.php # app/Classes/Modules/Segments/DataTransferObjects/SegmentObject.php # app/Classes/Modules/Segments/Services/CreatesSegment.php # app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php # app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php # app/Classes/Modules/Segments/Standards/Validators/SegmentValidation.php # app/Http/Controllers/Announcements/AssignAnnouncementToSegmentController.php # app/Http/Controllers/Announcements/ListAnnouncementsController.php # app/Http/Controllers/Announcements/RemoveSegmentFromAnnouncementController.php # app/Http/Controllers/Announcements/UpdateAnnouncementController.php # app/Http/Controllers/Segments/CreateSegmentController.php # app/Http/Controllers/Segments/DeleteSegmentController.php # routes/announcement.php # routes/api.php # routes/segment.php # routes/web.php
38 lines
988 B
PHP
38 lines
988 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Segments\Services;
|
|
|
|
|
|
use App\Classes\Modules\Currencies\Services\FetchesCurrency;
|
|
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
|
use App\Http\Resources\ConstantResource;
|
|
use App\Http\Resources\CurrencyResource;
|
|
use App\Models\SegmentConstant;
|
|
|
|
class ConvertsConstantDetailsToResource
|
|
{
|
|
|
|
/** @var FetchesCurrency */
|
|
private $fetchesCurrency;
|
|
|
|
/**
|
|
* ConvertsConstantDetailsToResource constructor.
|
|
* @param FetchesCurrency $fetchesCurrency
|
|
*/
|
|
public function __construct(FetchesCurrency $fetchesCurrency)
|
|
{
|
|
$this->fetchesCurrency = $fetchesCurrency;
|
|
}
|
|
|
|
|
|
public function execute(SegmentConstant $constant){
|
|
|
|
if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
|
|
return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
|
|
}
|
|
|
|
return $constant->detail;
|
|
|
|
}
|
|
|
|
} |