Files
shipping-portal/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php
T
2023-02-17 13:02:18 +08:00

53 lines
1.6 KiB
PHP

<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Create Supplier Transactions',
'message' => 'You have successfully created currency supplier transactions'
];
}
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var CreateInvoiceTransactionProcessor */
private $createInvoiceTransactionProcessor;
/**
* @param FetchesPackingList $fetchesPackingList
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
*/
public function __construct(FetchesPackingList $fetchesPackingList, CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor;
}
public function logic(Request $request) : JsonResponse
{
$packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]);
$this->createInvoiceTransactionProcessor->execute($packing_list);
return $this->response([]);
}
}