mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
1fbdc795ff
- Update Standard Segment Constant Logic Class - List Standard Segment Constant Logic Class - List Standard Segment Logic Class
69 lines
2.0 KiB
PHP
69 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\SegmentConstants\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\SegmentConstants\Services\ListsSegmentConstants;
|
|
use App\Classes\Modules\SegmentConstants\Standards\Rules\CanListStandardSegmentConstants;
|
|
use App\Http\Resources\SegmentResource;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListStandardSegmentConstantLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved Standard Segment Constant',
|
|
'message' => 'You have successfully retrieved a list of Standard Segment Constant'
|
|
];
|
|
}
|
|
|
|
/** @var CanListStandardSegmentConstants */
|
|
private $canListStandardSegmentConstants;
|
|
|
|
/** @var ListsSegmentConstants */
|
|
private $listsSegmentConstants;
|
|
|
|
/**
|
|
* ListStandardSegmentConstantLogic constructor.
|
|
* @param CanListStandardSegmentConstants $canListStandardSegmentConstants
|
|
* @param ListsSegmentConstants $listsSegmentConstants
|
|
*/
|
|
public function __construct(CanListStandardSegmentConstants $canListStandardSegmentConstants, ListsSegmentConstants $listsSegmentConstants)
|
|
{
|
|
$this->canListStandardSegmentConstants = $canListStandardSegmentConstants;
|
|
$this->listsSegmentConstants = $listsSegmentConstants;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws ErrorException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
try {
|
|
$this->canListStandardSegmentConstants->passes();
|
|
|
|
$query = $this->listsSegmentConstants->execute(
|
|
[
|
|
'segment_id' => 1
|
|
]
|
|
);
|
|
|
|
return $this->collectionResponse(SegmentResource::collection($query));
|
|
|
|
} catch (\Exception $exception){
|
|
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
|
}
|
|
|
|
}
|
|
|
|
} |