diff --git a/app/Classes/Modules/SegmentConstants/ControllerLogic/CreateSegmentConstantLogic.php b/app/Classes/Modules/SegmentConstants/ControllerLogic/CreateSegmentConstantLogic.php index 7f27e3f3..eaa27140 100644 --- a/app/Classes/Modules/SegmentConstants/ControllerLogic/CreateSegmentConstantLogic.php +++ b/app/Classes/Modules/SegmentConstants/ControllerLogic/CreateSegmentConstantLogic.php @@ -9,20 +9,8 @@ use App\Classes\Modules\Segments\Services\FetchesSegment; use App\Classes\Modules\SegmentConstants\Standards\Rules\CanCreateSegmentConstant; -use App\Classes\Modules\SegmentConstants\Services\CreatesSegmentConstantTax; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantTaxObject; - -use App\Classes\Modules\SegmentConstants\Services\CreatesSegmentConstantBillingFee; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantBillingFeeObject; - -use App\Classes\Modules\SegmentConstants\Services\CreatesSegmentConstantServiceCharge; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantServiceChargeObject; - -use App\Classes\Modules\SegmentConstants\Services\CreatesSegmentConstantBookingAmountMax; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantBookingAmountMaxObject; - -use App\Classes\Modules\SegmentConstants\Services\CreatesSegmentConstantPaymentAttemptExpiryTime; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantPaymentAttemptExpiryTimeObject; +use App\Classes\Modules\SegmentConstants\Services\CreatesSegmentConstant; +use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantObject; use App\Http\Resources\SegmentConstantResource; @@ -46,20 +34,8 @@ class CreateSegmentConstantLogic extends AbstractControllerLogic /** @var CanCreateSegmentConstant */ private $canCreateSegmentConstant; - /** @var CreatesSegmentConstantTax */ - private $createsSegmentConstantTax; - - /** @var CreatesSegmentConstantBillingFee */ - private $createsSegmentConstantBillingFee; - - /** @var CreatesSegmentConstantServiceCharge */ - private $createsSegmentConstantServiceCharge; - - /** @var CreatesSegmentConstantBookingAmountMax */ - private $createsSegmentConstantBookingAmountMax; - - /** @var CreatesSegmentConstantPaymentAttemptExpiryTime */ - private $createsSegmentConstantPaymentAttemptExpiryTime; + /** @var CreatesSegmentConstant */ + private $createsSegmentConstant; /** @var FetchesSegmentConstant */ private $fetchesSegmentConstant; @@ -70,31 +46,19 @@ class CreateSegmentConstantLogic extends AbstractControllerLogic /** * CreateSegmentConstantLogic constructor. * @param CanCreateSegmentConstant $canCreateSegmentConstant - * @param CreatesSegmentConstantTax $createsSegmentConstantTax - * @param CreatesSegmentConstantBillingFee $createsSegmentConstantBillingFee - * @param CreatesSegmentConstantServiceCharge $createsSegmentConstantServiceCharge - * @param CreatesSegmentConstantBookingAmountMax $createsSegmentConstantBookingAmountMax - * @param CreatesSegmentConstantPaymentAttemptExpiryTime $createsSegmentConstantPaymentAttemptExpiryTime + * @param createsSegmentConstant $createsSegmentConstantTax * @param FetchesSegmentConstant $fetchesSegmentConstant * @param FetchesSegment $fetchesSegment */ public function __construct( CanCreateSegmentConstant $canCreateSegmentConstant, - CreatesSegmentConstantTax $createsSegmentConstantTax, - CreatesSegmentConstantBillingFee $createsSegmentConstantBillingFee, - CreatesSegmentConstantServiceCharge $createsSegmentConstantServiceCharge, - CreatesSegmentConstantBookingAmountMax $createsSegmentConstantBookingAmountMax, - CreatesSegmentConstantPaymentAttemptExpiryTime $createsSegmentConstantPaymentAttemptExpiryTime, + CreatesSegmentConstant $createsSegmentConstant, FetchesSegmentConstant $fetchesSegmentConstant, FetchesSegment $fetchesSegment ) { $this->canCreateSegmentConstant = $canCreateSegmentConstant; - $this->createsSegmentConstantTax = $createsSegmentConstantTax; - $this->createsSegmentConstantBillingFee = $createsSegmentConstantBillingFee; - $this->createsSegmentConstantServiceCharge = $createsSegmentConstantServiceCharge; - $this->createsSegmentConstantBookingAmountMax = $createsSegmentConstantBookingAmountMax; - $this->createsSegmentConstantPaymentAttemptExpiryTime = $createsSegmentConstantPaymentAttemptExpiryTime; + $this->createsSegmentConstant = $createsSegmentConstant; $this->fetchesSegmentConstant = $fetchesSegmentConstant; $this->fetchesSegment = $fetchesSegment; } @@ -113,71 +77,24 @@ class CreateSegmentConstantLogic extends AbstractControllerLogic 'id' => $request->input('segment_id'), ]); - $segment_constant_query = $this->fetchesSegmentConstant->execute([ + $standard_segment_constant_query = $this->fetchesSegmentConstant->execute([ 'id' => $request->input('standard_segment_constant_id'), - ]); + ]); - if ($segment_constant_query->reference == 'TAX') { - $segment_constant_object = new SegmentConstantTaxObject( - $request->input('segment_id'), - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); + $segment_constant_object = new SegmentConstantObject( + $request->input('segment_id'), + $standard_segment_constant_query->name, + $standard_segment_constant_query->reference, + $standard_segment_constant_query->detail->type, + $request->input('detail') + ); - $this->canCreateSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->createsSegmentConstantTax->execute($segment_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'BILLING_FEE') { - $segment_constant_object = new SegmentConstantBillingFeeObject( - $request->input('segment_id'), - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canCreateSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->createsSegmentConstantBillingFee->execute($segment_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'SERVICE_CHARGE') { - $segment_constant_object = new SegmentConstantServiceChargeObject( - $request->input('segment_id'), - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canCreateSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->createsSegmentConstantServiceCharge->execute($segment_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'BOOKING_AMOUNT_MAX') { - $segment_constant_object = new SegmentConstantBookingAmountMaxObject( - $request->input('segment_id'), - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value'), - $segment_constant_query->detail->currency_id - ); - $this->canCreateSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->createsSegmentConstantBookingAmountMax->execute($segment_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'PAYMENT_ATTEMP_EXPIRY_TIME') { - $segment_constant_object = new SegmentConstantPaymentAttemptExpiryTimeObject( - $request->input('segment_id'), - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canCreateSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->createsSegmentConstantPaymentAttemptExpiryTime->execute($segment_query, $segment_constant_object); - } + $this->canCreateSegmentConstant->passes($segment_constant_object); + $standard_segment_constant_query = $this->createsSegmentConstant->execute($segment_query, $segment_constant_object); DB::commit(); - return $this->resourceResponse(new SegmentConstantResource($segment_constant_query)); + return $this->resourceResponse(new SegmentConstantResource($standard_segment_constant_query)); } catch (\Exception $exception) { throw new ErrorException($exception->getMessage(), $exception->getCode()); diff --git a/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateSegmentConstantLogic.php b/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateSegmentConstantLogic.php index c4ecf270..73250c47 100644 --- a/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateSegmentConstantLogic.php +++ b/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateSegmentConstantLogic.php @@ -6,22 +6,10 @@ use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\SegmentConstants\Services\FetchesSegmentConstant; -use App\Classes\Modules\SegmentConstants\Standards\Rules\CanUpdateStandardSegmentConstant; +use App\Classes\Modules\SegmentConstants\Standards\Rules\CanUpdateSegmentConstant; -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantTax; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantTaxObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantBillingFee; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantBillingFeeObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantServiceCharge; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantServiceChargeObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantBookingAmountMax; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantBookingAmountMaxObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantPaymentAttemptExpiryTime; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantPaymentAttemptExpiryTimeObject; +use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstant; +use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantObject; use App\Http\Resources\SegmentConstantResource; @@ -43,53 +31,29 @@ class UpdateSegmentConstantLogic extends AbstractControllerLogic ]; } - /** @var CanUpdateStandardSegmentConstant */ - private $canUpdateStandardSegmentConstant; + /** @var CanUpdateSegmentConstant */ + private $canUpdateSegmentConstant; - /** @var UpdatesSegmentConstantTax */ - private $updatesSegmentConstantTax; - - /** @var UpdatesSegmentConstantBillingFee */ - private $updatesSegmentConstantBillingFee; - - /** @var UpdatesSegmentConstantServiceCharge */ - private $updatesSegmentConstantServiceCharge; - - /** @var UpdatesSegmentConstantBookingAmountMax */ - private $updatesSegmentConstantBookingAmountMax; - - /** @var UpdatesSegmentConstantPaymentAttemptExpiryTime */ - private $updatesSegmentConstantPaymentAttemptExpiryTime; + /** @var UpdatesSegmentConstant */ + private $updatesSegmentConstant; /** @var FetchesSegmentConstant */ private $fetchesSegmentConstant; /** * UpdateStandardSegmentConstantLogic constructor. - * @param CanUpdateStandardSegmentConstant $canUpdateStandardSegmentConstant - * @param UpdatesSegmentConstantTax $updatesSegmentConstantTax - * @param UpdatesSegmentConstantBillingFee $updatesSegmentConstantBillingFee - * @param UpdatesSegmentConstantServiceCharge $updatesSegmentConstantServiceCharge - * @param UpdatesSegmentConstantBookingAmountMax $updatesSegmentConstantBookingAmountMax - * @param UpdatesSegmentConstantPaymentAttemptExpiryTime $updatesSegmentConstantPaymentAttemptExpiryTime + * @param CanUpdateSegmentConstant $canUpdateSegmentConstant + * @param UpdatesSegmentConstant $updatesSegmentConstant * @param FetchesSegmentConstant $fetchesSegmentConstant */ public function __construct( - CanUpdateStandardSegmentConstant $canUpdateStandardSegmentConstant, - UpdatesSegmentConstantTax $updatesSegmentConstantTax, - UpdatesSegmentConstantBillingFee $updatesSegmentConstantBillingFee, - UpdatesSegmentConstantServiceCharge $updatesSegmentConstantServiceCharge, - UpdatesSegmentConstantBookingAmountMax $updatesSegmentConstantBookingAmountMax, - UpdatesSegmentConstantPaymentAttemptExpiryTime $updatesSegmentConstantPaymentAttemptExpiryTime, + CanUpdateSegmentConstant $canUpdateSegmentConstant, + UpdatesSegmentConstant $updatesSegmentConstant, FetchesSegmentConstant $fetchesSegmentConstant ) { - $this->canUpdateStandardSegmentConstant = $canUpdateStandardSegmentConstant; - $this->updatesSegmentConstantTax = $updatesSegmentConstantTax; - $this->updatesSegmentConstantBillingFee = $updatesSegmentConstantBillingFee; - $this->updatesSegmentConstantServiceCharge = $updatesSegmentConstantServiceCharge; - $this->updatesSegmentConstantBookingAmountMax = $updatesSegmentConstantBookingAmountMax; - $this->updatesSegmentConstantPaymentAttemptExpiryTime = $updatesSegmentConstantPaymentAttemptExpiryTime; + $this->canUpdateSegmentConstant = $canUpdateSegmentConstant; + $this->updatesSegmentConstant = $updatesSegmentConstant; $this->fetchesSegmentConstant = $fetchesSegmentConstant; } @@ -105,63 +69,16 @@ class UpdateSegmentConstantLogic extends AbstractControllerLogic $segment_constant_query = $this->fetchesSegmentConstant->execute(['id' => $request->route('id')]); - if ($segment_constant_query->reference == 'TAX') { - $segment_constant_object = new SegmentConstantTaxObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); + $segment_constant_object = new SegmentConstantObject( + $segment_constant_query->segment_id, + $segment_constant_query->name, + $segment_constant_query->reference, + $segment_constant_query->detail->type, + $request->input('detail') + ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantTax->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'BILLING_FEE') { - $segment_constant_object = new SegmentConstantBillingFeeObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantBillingFee->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'SERVICE_CHARGE') { - $segment_constant_object = new SegmentConstantServiceChargeObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantServiceCharge->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'BOOKING_AMOUNT_MAX') { - $segment_constant_object = new SegmentConstantBookingAmountMaxObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value'), - $segment_constant_query->detail->currency_id - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantBookingAmountMax->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'PAYMENT_ATTEMP_EXPIRY_TIME') { - $segment_constant_object = new SegmentConstantPaymentAttemptExpiryTimeObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantPaymentAttemptExpiryTime->execute($segment_constant_query, $segment_constant_object); - } + $this->canUpdateSegmentConstant->passes($segment_constant_object); + $segment_constant_query = $this->updatesSegmentConstant->execute($segment_constant_query, $segment_constant_object); DB::commit(); diff --git a/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateStandardSegmentConstantLogic.php b/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateStandardSegmentConstantLogic.php index bdb42ff5..55c4ea78 100644 --- a/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateStandardSegmentConstantLogic.php +++ b/app/Classes/Modules/SegmentConstants/ControllerLogic/UpdateStandardSegmentConstantLogic.php @@ -8,20 +8,8 @@ use App\Classes\Modules\SegmentConstants\Services\FetchesSegmentConstant; use App\Classes\Modules\SegmentConstants\Standards\Rules\CanUpdateStandardSegmentConstant; -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantTax; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantTaxObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantBillingFee; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantBillingFeeObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantServiceCharge; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantServiceChargeObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantBookingAmountMax; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantBookingAmountMaxObject; - -use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstantPaymentAttemptExpiryTime; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantPaymentAttemptExpiryTimeObject; +use App\Classes\Modules\SegmentConstants\Services\UpdatesSegmentConstant; +use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantObject; use App\Http\Resources\SegmentConstantResource; @@ -32,7 +20,6 @@ use Illuminate\Support\Facades\DB; class UpdateStandardSegmentConstantLogic extends AbstractControllerLogic { - /** * @return array */ @@ -47,19 +34,7 @@ class UpdateStandardSegmentConstantLogic extends AbstractControllerLogic private $canUpdateStandardSegmentConstant; /** @var UpdatesSegmentConstantTax */ - private $updatesSegmentConstantTax; - - /** @var UpdatesSegmentConstantBillingFee */ - private $updatesSegmentConstantBillingFee; - - /** @var UpdatesSegmentConstantServiceCharge */ - private $updatesSegmentConstantServiceCharge; - - /** @var UpdatesSegmentConstantBookingAmountMax */ - private $updatesSegmentConstantBookingAmountMax; - - /** @var UpdatesSegmentConstantPaymentAttemptExpiryTime */ - private $updatesSegmentConstantPaymentAttemptExpiryTime; + private $updatesSegmentConstant; /** @var FetchesSegmentConstant */ private $fetchesSegmentConstant; @@ -67,29 +42,17 @@ class UpdateStandardSegmentConstantLogic extends AbstractControllerLogic /** * UpdateStandardSegmentConstantLogic constructor. * @param CanUpdateStandardSegmentConstant $canUpdateStandardSegmentConstant - * @param UpdatesSegmentConstantTax $updatesSegmentConstantTax - * @param UpdatesSegmentConstantBillingFee $updatesSegmentConstantBillingFee - * @param UpdatesSegmentConstantServiceCharge $updatesSegmentConstantServiceCharge - * @param UpdatesSegmentConstantBookingAmountMax $updatesSegmentConstantBookingAmountMax - * @param UpdatesSegmentConstantPaymentAttemptExpiryTime $updatesSegmentConstantPaymentAttemptExpiryTime + * @param UpdatesSegmentConstant $updatesSegmentConstant * @param FetchesSegmentConstant $fetchesSegmentConstant */ public function __construct( CanUpdateStandardSegmentConstant $canUpdateStandardSegmentConstant, - UpdatesSegmentConstantTax $updatesSegmentConstantTax, - UpdatesSegmentConstantBillingFee $updatesSegmentConstantBillingFee, - UpdatesSegmentConstantServiceCharge $updatesSegmentConstantServiceCharge, - UpdatesSegmentConstantBookingAmountMax $updatesSegmentConstantBookingAmountMax, - UpdatesSegmentConstantPaymentAttemptExpiryTime $updatesSegmentConstantPaymentAttemptExpiryTime, + UpdatesSegmentConstant $updatesSegmentConstant, FetchesSegmentConstant $fetchesSegmentConstant ) { $this->canUpdateStandardSegmentConstant = $canUpdateStandardSegmentConstant; - $this->updatesSegmentConstantTax = $updatesSegmentConstantTax; - $this->updatesSegmentConstantBillingFee = $updatesSegmentConstantBillingFee; - $this->updatesSegmentConstantServiceCharge = $updatesSegmentConstantServiceCharge; - $this->updatesSegmentConstantBookingAmountMax = $updatesSegmentConstantBookingAmountMax; - $this->updatesSegmentConstantPaymentAttemptExpiryTime = $updatesSegmentConstantPaymentAttemptExpiryTime; + $this->updatesSegmentConstant = $updatesSegmentConstant; $this->fetchesSegmentConstant = $fetchesSegmentConstant; } @@ -105,63 +68,16 @@ class UpdateStandardSegmentConstantLogic extends AbstractControllerLogic $segment_constant_query = $this->fetchesSegmentConstant->execute(['id' => $request->route('id')]); - if ($segment_constant_query->reference == 'TAX') { - $segment_constant_object = new SegmentConstantTaxObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); + $segment_constant_object = new SegmentConstantObject( + $segment_constant_query->segment_id, + $segment_constant_query->name, + $segment_constant_query->reference, + $segment_constant_query->detail->type, + $request->input('detail') + ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantTax->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'BILLING_FEE') { - $segment_constant_object = new SegmentConstantBillingFeeObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantBillingFee->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'SERVICE_CHARGE') { - $segment_constant_object = new SegmentConstantServiceChargeObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantServiceCharge->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'BOOKING_AMOUNT_MAX') { - $segment_constant_object = new SegmentConstantBookingAmountMaxObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value'), - $segment_constant_query->detail->currency_id - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantBookingAmountMax->execute($segment_constant_query, $segment_constant_object); - } - elseif ($segment_constant_query->reference == 'PAYMENT_ATTEMP_EXPIRY_TIME') { - $segment_constant_object = new SegmentConstantPaymentAttemptExpiryTimeObject( - $segment_constant_query->segment_id, - $segment_constant_query->name, - $segment_constant_query->reference, - $segment_constant_query->detail->type, - $request->input('value') - ); - $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); - $segment_constant_query = $this->updatesSegmentConstantPaymentAttemptExpiryTime->execute($segment_constant_query, $segment_constant_object); - } + $this->canUpdateStandardSegmentConstant->passes($segment_constant_object); + $segment_constant_query = $this->updatesSegmentConstant->execute($segment_constant_query, $segment_constant_object); DB::commit(); diff --git a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantBookingAmountMaxObject.php b/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantBookingAmountMaxObject.php deleted file mode 100644 index 709cdb18..00000000 --- a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantBookingAmountMaxObject.php +++ /dev/null @@ -1,100 +0,0 @@ -segment_id = $segment_id; - $this->name = $name; - $this->reference = $reference; - $this->type = $type; - $this->value = $value; - $this->currency_id = $currency_id; - } - - /** - * @return int - */ - public function getSegmentId(): ?int - { - return $this->segment_id; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @return string - */ - public function getReference(): ?string - { - return $this->reference; - } - - /** - * @return string - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * @return int - */ - public function getValue(): ?int - { - return $this->value; - } - - /** - * @return int - */ - public function getCurrencyId(): ?int - { - return $this->currency_id; - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantBillingFeeObject.php b/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantObject.php similarity index 82% rename from app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantBillingFeeObject.php rename to app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantObject.php index 2cac6d93..e80f7c49 100644 --- a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantBillingFeeObject.php +++ b/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantObject.php @@ -4,7 +4,7 @@ namespace App\Classes\Modules\SegmentConstants\DataTransferObjects; use App\Classes\Interfaces\DataTransferObject; -class SegmentConstantBillingFeeObject implements DataTransferObject +class SegmentConstantObject implements DataTransferObject { /** @var int|null */ private $segment_id; @@ -18,8 +18,8 @@ class SegmentConstantBillingFeeObject implements DataTransferObject /** @var int */ private $type; - /** @var int */ - private $value; + /** @var array */ + private $detail; /** * SegmentConstantObject constructor. @@ -27,21 +27,21 @@ class SegmentConstantBillingFeeObject implements DataTransferObject * @param string|null $name * @param string|null $reference * @param string|null $type - * @param int|null $value + * @param array|null $detail */ public function __construct( ?int $segment_id, ?string $name, ?string $reference, ?string $type, - ?int $value + ?array $detail ) { $this->segment_id = $segment_id; $this->name = $name; $this->reference = $reference; $this->type = $type; - $this->value = $value; + $this->detail = $detail; } /** @@ -77,10 +77,10 @@ class SegmentConstantBillingFeeObject implements DataTransferObject } /** - * @return int + * @return array */ - public function getValue(): ?int + public function getDetail(): ?array { - return $this->value; + return $this->detail; } } \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantPaymentAttemptExpiryTimeObject.php b/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantPaymentAttemptExpiryTimeObject.php deleted file mode 100644 index 7b97584f..00000000 --- a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantPaymentAttemptExpiryTimeObject.php +++ /dev/null @@ -1,86 +0,0 @@ -segment_id = $segment_id; - $this->name = $name; - $this->reference = $reference; - $this->type = $type; - $this->value = $value; - } - - /** - * @return int - */ - public function getSegmentId(): ?int - { - return $this->segment_id; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @return string - */ - public function getReference(): ?string - { - return $this->reference; - } - - /** - * @return string - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * @return int - */ - public function getValue(): ?int - { - return $this->value; - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantServiceChargeObject.php b/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantServiceChargeObject.php deleted file mode 100644 index 4f3adfa1..00000000 --- a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantServiceChargeObject.php +++ /dev/null @@ -1,86 +0,0 @@ -segment_id = $segment_id; - $this->name = $name; - $this->reference = $reference; - $this->type = $type; - $this->value = $value; - } - - /** - * @return int - */ - public function getSegmentId(): ?int - { - return $this->segment_id; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @return string - */ - public function getReference(): ?string - { - return $this->reference; - } - - /** - * @return string - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * @return int - */ - public function getValue(): ?int - { - return $this->value; - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantTaxObject.php b/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantTaxObject.php deleted file mode 100644 index b7125cd1..00000000 --- a/app/Classes/Modules/SegmentConstants/DataTransferObjects/SegmentConstantTaxObject.php +++ /dev/null @@ -1,86 +0,0 @@ -segment_id = $segment_id; - $this->name = $name; - $this->reference = $reference; - $this->type = $type; - $this->value = $value; - } - - /** - * @return int - */ - public function getSegmentId(): ?int - { - return $this->segment_id; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @return string - */ - public function getReference(): ?string - { - return $this->reference; - } - - /** - * @return string - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * @return int - */ - public function getValue(): ?int - { - return $this->value; - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantTax.php b/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstant.php similarity index 68% rename from app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantTax.php rename to app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstant.php index 64b2e7a5..72d22d90 100644 --- a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantTax.php +++ b/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstant.php @@ -3,27 +3,24 @@ namespace App\Classes\Modules\SegmentConstants\Services; use App\Classes\General\Eloquent\AbstractUpdateRecord; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantTaxObject; +use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantObject; use App\Models\SegmentConstant; use App\Models\Segment; -class CreatesSegmentConstantTax extends AbstractUpdateRecord +class CreatesSegmentConstant extends AbstractUpdateRecord { /** * @param SegmentConstantTaxObject $object * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException */ - public function execute(Segment $segment, SegmentConstantTaxObject $object) + public function execute(Segment $segment, SegmentConstantObject $object) { $model = new SegmentConstant(); $model->segment_id = $object->getSegmentId(); $model->name = $object->getName(); $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue() - ]); + $model->detail = json_encode($object->getDetail()); return $this->handler($model); } diff --git a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantBillingFee.php b/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantBillingFee.php deleted file mode 100644 index 55133247..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantBillingFee.php +++ /dev/null @@ -1,30 +0,0 @@ -segment_id = $segment->id; - $model->name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue() - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantBookingAmountMax.php b/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantBookingAmountMax.php deleted file mode 100644 index 61971f50..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantBookingAmountMax.php +++ /dev/null @@ -1,31 +0,0 @@ -segment_id = $segment->id; - $model->name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue(), - 'currency_id' => $object->getCurrencyId() - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantPaymentAttemptExpiryTime.php b/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantPaymentAttemptExpiryTime.php deleted file mode 100644 index ae6077b8..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantPaymentAttemptExpiryTime.php +++ /dev/null @@ -1,30 +0,0 @@ -segment_id = $object->getSegmentId(); - $model->name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue(), - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantServiceCharge.php b/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantServiceCharge.php deleted file mode 100644 index 695b7df9..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/CreatesSegmentConstantServiceCharge.php +++ /dev/null @@ -1,30 +0,0 @@ -segment_id = $object->getSegmentId(); - $model->name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue() - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantTax.php b/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstant.php similarity index 66% rename from app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantTax.php rename to app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstant.php index 2b02e9f9..6041d8c5 100644 --- a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantTax.php +++ b/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstant.php @@ -3,25 +3,22 @@ namespace App\Classes\Modules\SegmentConstants\Services; use App\Classes\General\Eloquent\AbstractUpdateRecord; -use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantTaxObject; +use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantObject; use App\Models\SegmentConstant; -class UpdatesSegmentConstantTax extends AbstractUpdateRecord +class UpdatesSegmentConstant extends AbstractUpdateRecord { /** - * @param SegmentConstantTaxObject $object + * @param SegmentConstantObject $object * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException */ - public function execute(SegmentConstant $model, SegmentConstantTaxObject $object) + public function execute(SegmentConstant $model, SegmentConstantObject $object) { $model->name = $object->getName(); $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue() - ]); + $model->detail = json_encode($object->getDetail()); return $this->handler($model); } diff --git a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantBillingFee.php b/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantBillingFee.php deleted file mode 100644 index 573d287b..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantBillingFee.php +++ /dev/null @@ -1,28 +0,0 @@ -name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue() - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantBookingAmountMax.php b/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantBookingAmountMax.php deleted file mode 100644 index 8885a701..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantBookingAmountMax.php +++ /dev/null @@ -1,29 +0,0 @@ -name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue(), - 'currency_id' => $object->getCurrencyId(), - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantPaymentAttemptExpiryTime.php b/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantPaymentAttemptExpiryTime.php deleted file mode 100644 index 5acdd9e9..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantPaymentAttemptExpiryTime.php +++ /dev/null @@ -1,28 +0,0 @@ -name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue() - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantServiceCharge.php b/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantServiceCharge.php deleted file mode 100644 index afa201f5..00000000 --- a/app/Classes/Modules/SegmentConstants/Services/UpdatesSegmentConstantServiceCharge.php +++ /dev/null @@ -1,28 +0,0 @@ -name = $object->getName(); - $model->reference = $object->getReference(); - $model->detail = json_encode([ - 'type' => $object->getType(), - 'value' => $object->getValue() - ]); - - return $this->handler($model); - } -} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Standards/Rules/CanUpdateSegmentConstant.php b/app/Classes/Modules/SegmentConstants/Standards/Rules/CanUpdateSegmentConstant.php new file mode 100644 index 00000000..07831082 --- /dev/null +++ b/app/Classes/Modules/SegmentConstants/Standards/Rules/CanUpdateSegmentConstant.php @@ -0,0 +1,58 @@ +segmentConstantValidation = $segmentConstantValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + + if (!\Auth::user()->can('view segment_constant')) { + return false; + } + + return true; + } + + /** + * @param SegmentConstantValidation $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->segmentConstantValidation->validate($object, 'PUT'); + } + + /** + * @param SegmentConstantValidation $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/SegmentConstants/Standards/Validators/SegmentConstantValidation.php b/app/Classes/Modules/SegmentConstants/Standards/Validators/SegmentConstantValidation.php index 9a09a074..38035944 100644 --- a/app/Classes/Modules/SegmentConstants/Standards/Validators/SegmentConstantValidation.php +++ b/app/Classes/Modules/SegmentConstants/Standards/Validators/SegmentConstantValidation.php @@ -14,106 +14,28 @@ class SegmentConstantValidation extends AbstractValidation */ protected function data($object): array { - $this->reference = $object->getReference(); - if ($this->reference == 'TAX') { - return [ - 'segment_id'=> $object->getSegmentId(), - 'name' => $object->getName(), - 'reference' => $object->getReference(), - 'type' => $object->getType(), - 'value' => $object->getValue() - ]; - } - elseif ($this->reference == 'BILLING_FEE') { - return [ - 'segment_id' => $object->getSegmentId(), - 'name' => $object->getName(), - 'reference' => $object->getReference(), - 'type' => $object->getType(), - 'value' => $object->getValue() - ]; - } - elseif ($this->reference == 'SERVICE_CHARGE') { - return [ - 'segment_id' => $object->getSegmentId(), - 'name' => $object->getName(), - 'reference' => $object->getReference(), - 'type' => $object->getType(), - 'value' => $object->getValue() - ]; - } - elseif ($this->reference == 'BOOKING_AMOUNT_MAX') { - return [ - 'segment_id' => $object->getSegmentId(), - 'name' => $object->getName(), - 'reference' => $object->getReference(), - 'type' => $object->getType(), - 'value' => $object->getValue(), - 'currency_id' => $object->getCurrencyId() - ]; - } - elseif ($this->reference == 'PAYMENT_ATTEMP_EXPIRY_TIME') { - return [ - 'segment_id' => $object->getSegmentId(), - 'name' => $object->getName(), - 'reference' => $object->getReference(), - 'type' => $object->getType(), - 'value' => $object->getValue() - ]; - } + $data = [ + 'segment_id'=> $object->getSegmentId(), + 'name' => $object->getName(), + 'reference' => $object->getReference(), + 'type' => $object->getType(), + 'detail' => $object->getDetail() + ]; + + return $data; } /** * @return array */ protected function rules(?string $type = 'POST'): array { - - if ($this->reference == 'TAX') { - return [ - 'segment_id' => $type == 'POST' ? 'required' : '', - 'name' => 'required', - 'reference' => 'required', - 'type' => 'required', - 'value' => 'required' - ]; - } - elseif ($this->reference == 'BILLING_FEE') { - return [ - 'segment_id' => $type == 'POST' ? 'required' : '', - 'name' => 'required', - 'reference' => 'required', - 'type' => 'required', - 'value' => 'required' - ]; - } - elseif ($this->reference == 'SERVICE_CHARGE') { - return [ - 'segment_id' => $type == 'POST' ? 'required' : '', - 'name' => 'required', - 'reference' => 'required', - 'type' => 'required', - 'value' => 'required' - ]; - } - elseif ($this->reference == 'BOOKING_AMOUNT_MAX') { - return [ - 'segment_id' => $type == 'POST' ? 'required' : '', - 'name' => 'required', - 'reference' => 'required', - 'type' => 'required', - 'value' => 'required', - 'currency_id' => 'required' - ]; - } - elseif ($this->reference == 'PAYMENT_ATTEMP_EXPIRY_TIME') { - return [ - 'segment_id' => $type == 'POST' ? 'required' : '', - 'name' => 'required', - 'reference' => 'required', - 'type' => 'required', - 'value' => 'required', - ]; - } + return [ + 'segment_id' => $type == 'POST' ? 'required' : '', + 'name' => 'required', + 'reference' => 'required', + 'type' => 'required', + 'detail' => 'required' + ]; } /** diff --git a/routes/api.php b/routes/api.php index 7199a37a..81dc15d3 100644 --- a/routes/api.php +++ b/routes/api.php @@ -21,8 +21,6 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function require __DIR__ . '/document.php'; require __DIR__ . '/segment.php'; - require __DIR__ . '/segment_constant.php'; - Route::group(['middleware' => 'valid.token'], function () { require __DIR__ . '/crud.php'; diff --git a/routes/segment.php b/routes/segment.php index 4ca1f3fb..0d8c7652 100644 --- a/routes/segment.php +++ b/routes/segment.php @@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route; Route::group(['namespace' => 'StandardSegments'], function () { Route::group(['middleware' => 'valid.token'], function () { Route::group(['prefix' => 'standard-segment'], function () { - Route::get('/list', 'ListStandardSegmentsController@list')->name('standard_segment.update'); + Route::get('/list', 'ListStandardSegmentsController@list')->name('standard_segment.list'); }); }); }); @@ -18,4 +18,23 @@ Route::group(['namespace' => 'Segments'], function () { Route::delete('/delete/{id}', 'DeleteSegmentController@delete')->name('segment.delete'); }); }); +}); + +Route::group(['namespace' => 'StandardSegmentConstants'], function () { + Route::group(['middleware' => 'valid.token'], function () { + Route::group(['prefix' => 'standard-segment-constant'], function () { + Route::get('/list', 'ListStandardSegmentConstantsController@list')->name('standard_segment.update'); + Route::put('/update/{id}', 'UpdateStandardSegmentConstantController@update')->name('standard_segment_constant.update'); + }); + }); +}); + +Route::group(['namespace' => 'SegmentConstants'], function () { + Route::group(['middleware' => 'valid.token'], function () { + Route::group(['prefix' => 'segment-constant'], function () { + // Route::get('/list', 'ListStandardSegmentConstantsController@list')->name('standard_segment.update'); + Route::post('/create', 'CreateSegmentConstantController@create')->name('segment_constant.create'); + Route::put('/update/{id}', 'UpdateSegmentConstantController@update')->name('segment_constant.update'); + }); + }); }); \ No newline at end of file diff --git a/routes/segment_constant.php b/routes/segment_constant.php deleted file mode 100644 index 7f61aaa4..00000000 --- a/routes/segment_constant.php +++ /dev/null @@ -1,23 +0,0 @@ - 'StandardSegmentConstants'], function () { - Route::group(['middleware' => 'valid.token'], function () { - Route::group(['prefix' => 'standard-segment-constant'], function () { - Route::get('/list', 'ListStandardSegmentConstantsController@list')->name('standard_segment.update'); - Route::put('/update/{id}', 'UpdateStandardSegmentConstantController@update')->name('standard_segment_constant.update'); - }); - }); -}); - - -Route::group(['namespace' => 'SegmentConstants'], function () { - Route::group(['middleware' => 'valid.token'], function () { - Route::group(['prefix' => 'segment-constant'], function () { - // Route::get('/list', 'ListStandardSegmentConstantsController@list')->name('standard_segment.update'); - Route::post('/create', 'CreateSegmentConstantController@create')->name('segment_constant.create'); - Route::put('/update/{id}', 'UpdateSegmentConstantController@update')->name('segment_constant.update'); - }); - }); -}); \ No newline at end of file