Files
shipping-portal/app/Classes/Modules/Transactions/ControllersLogic/FetchInvoiceLogic.php
T
2022-12-27 12:34:29 -03:00

56 lines
1.2 KiB
PHP

<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\FetchPayments;
use App\Classes\Modules\Transactions\Services\ListsTransactions;
use App\Http\Resources\InvoiceResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchInvoiceLogic extends AbstractControllerLogic
{
/**
* ListTransactionsLogic constructor.
* @param FetchPayments $fetchPayments
*/
public function __construct(FetchPayments $fetchPayments)
{
$this->fetchPayments = $fetchPayments;
}
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Transactions',
'message' => 'You have successfully retrieved a list of transactions'
];
}
/** @var FetchPayments */
private $fetchPayments;
public function logic(Request $request) : JsonResponse
{
$query = $this->fetchPayments->execute($this->fetchPayments->deserializeFilters($request->input('filters')));
return $this->collectionResponse(InvoiceResource::collection($query));
}
}
?>