mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 20:43:56 +00:00
63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Documents\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Documents\Services\ListsDocuments;
|
|
use App\Classes\Modules\Documents\Standards\Rules\CanListDocuments;
|
|
use App\Http\Resources\DocumentResource;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListDocumentLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved Document',
|
|
'message' => 'You have successfully retrieved a list of Document'
|
|
];
|
|
}
|
|
|
|
/** @var CanListDocuments */
|
|
private $canListDocuments;
|
|
|
|
/** @var ListsDocuments */
|
|
private $listsDocuments;
|
|
|
|
/**
|
|
* ListStandardSegmentLogic constructor.
|
|
* @param CanListDocuments $canListDocuments
|
|
* @param ListsDocuments $listsDocuments
|
|
*/
|
|
public function __construct(CanListDocuments $canListDocuments, ListsDocuments $listsDocuments)
|
|
{
|
|
$this->canListDocuments = $canListDocuments;
|
|
$this->listsDocuments = $listsDocuments;
|
|
}
|
|
|
|
|
|
/**
|
|
* @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
|
|
{
|
|
|
|
$this->canListDocuments->passes();
|
|
|
|
$query = $this->listsDocuments->execute($this->listsDocuments->deserializeFilters($request->input('filters')));
|
|
|
|
return $this->collectionResponse(DocumentResource::collection($query));
|
|
|
|
}
|
|
|
|
} |