mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-23 06:24:10 +00:00
67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Transactions\Services\ListsTransactions;
|
|
use App\Classes\ValueObjects\Constants\TransactionType;
|
|
use App\Http\Resources\TransactionResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListCompanyModuleInvoicesLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification(): array
|
|
{
|
|
return [
|
|
'title' => 'Retrieved Company Module Invoices',
|
|
'message' => 'You have successfully retrieved a list of Invoices'
|
|
];
|
|
}
|
|
|
|
/** @var ListsTransactions */
|
|
private $listsTransactions;
|
|
|
|
/**
|
|
* ListCompanyModuleInvoicesLogic constructor.
|
|
* @param ListsTransactions $listsTransactions
|
|
*/
|
|
public function __construct(ListsTransactions $listsTransactions)
|
|
{
|
|
$this->listsTransactions = $listsTransactions;
|
|
}
|
|
|
|
|
|
/**
|
|
* @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
|
|
{
|
|
$filterArray = [
|
|
"per_page" => 10,
|
|
"order_by" => (object)[
|
|
"column" => 'id',
|
|
"DESC" => true,
|
|
],
|
|
"status_in" => [2],
|
|
"receiver" => intval($request->route('company_module_id')),
|
|
"type" => TransactionType::SHIPPING_INVOICE
|
|
];
|
|
|
|
// $this->canListTransactions->passes();
|
|
|
|
$query = $this->listsTransactions->execute($filterArray);
|
|
|
|
return $this->collectionResponse(TransactionResource::collection($query));
|
|
}
|
|
}
|