mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\SegmentConstants\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
|
use App\Http\Resources\ConstantResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class FetchSegmentConstantLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved Segment Constant',
|
|
'message' => 'You have successfully retrieved a segment constant'
|
|
];
|
|
}
|
|
|
|
/** @var FetchesConstant */
|
|
private $fetchesConstant;
|
|
|
|
/**
|
|
* FetchSegmentLogic constructor.
|
|
* @param FetchesConstant $fetchesConstant
|
|
*/
|
|
public function __construct(FetchesConstant $fetchesConstant)
|
|
{
|
|
$this->fetchesConstant = $fetchesConstant;
|
|
}
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$query = $this->fetchesConstant->execute(['id' => $request->route('id')]);
|
|
|
|
return $this->resourceResponse(new ConstantResource($query));
|
|
|
|
}
|
|
|
|
} |