mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Remarks\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Remarks\Services\ListsRemarks;
|
|
use App\Classes\Modules\Remarks\Standards\Rules\CanListRemarks;
|
|
use App\Http\Resources\RemarkResource;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListRemarksLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved Remarks',
|
|
'message' => 'You have successfully retrieved a list of Remarks'
|
|
];
|
|
}
|
|
|
|
/** @var CanListRemarks */
|
|
private $canListRemarks;
|
|
|
|
/** @var ListsRemarks */
|
|
private $listsRemarks;
|
|
|
|
/**
|
|
* ListRemarksLogic constructor.
|
|
* @param CanListRemarks $canListRemarks
|
|
* @param ListsRemarks $listsRemarks
|
|
*/
|
|
public function __construct(CanListRemarks $canListRemarks, ListsRemarks $listsRemarks)
|
|
{
|
|
$this->canListRemarks = $canListRemarks;
|
|
$this->listsRemarks = $listsRemarks;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws ErrorException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$this->canListRemarks->passes();
|
|
|
|
$query = $this->listsRemarks->execute($this->listsRemarks->deserializeFilters($request->input('filters')));
|
|
|
|
return $this->collectionResponse(RemarkResource::collection($query));
|
|
}
|
|
|
|
}
|