mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-09-01 10:54:00 +00:00
Code Refactoring/Reorganize to remove redundancy
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\KeyValuePairs\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\KeyValuePairs\Services\ListsKeyValuePairs;
|
||||
use App\Classes\Modules\ServiceTypes\Standards\Rules\CanListServiceTypes;
|
||||
use App\Http\Resources\LockResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListLocksLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Locks',
|
||||
'message' => 'You have successfully retrieved a list of Locks'
|
||||
];
|
||||
}
|
||||
|
||||
// /** @var CanListServiceTypes */
|
||||
// private $canListServiceTypes;
|
||||
|
||||
/** @var ListsKeyValuePairs */
|
||||
private $listsKeyValuePairs;
|
||||
|
||||
/**
|
||||
* ListLocksLogic constructor.
|
||||
* @param CanListServiceTypes $canListServiceTypes
|
||||
* @param ListsKeyValuePairs $listsKeyValuePairs
|
||||
*/
|
||||
public function __construct(CanListServiceTypes $canListServiceTypes, ListsKeyValuePairs $listsKeyValuePairs)
|
||||
{
|
||||
// $this->canListServiceTypes = $canListServiceTypes;
|
||||
$this->listsKeyValuePairs = $listsKeyValuePairs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
// cief todo: 110 - CanListLocks
|
||||
|
||||
// $this->canListServiceTypes->passes();
|
||||
|
||||
$query = $this->listsKeyValuePairs->execute($this->listsKeyValuePairs->deserializeFilters($request->input('filters')));
|
||||
|
||||
return $this->collectionResponse(LockResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user