'Created Bank', 'message' => 'You have successfully created a new Bank' ]; } /** @var CanCreateBank */ private $canCreateBank; /** @var CreatesBank */ private $createsBank; /** @var CreatesBankLog */ private $createsBankLog; /** @var FetchesCompany */ private $fetchesCompany; /** @var CheckMilestonesForRewardProcessor */ private $checkMilestonesForRewardProcessor; /** * CreateBankLogic constructor. * @param CanCreateBank $canCreateBank * @param CreatesBank $createsBank * @param CreatesBankLog $createsBankLog * @param FetchesCompany $fetchesCompany * @param CheckMilestonesForRewardProcessor $checkMilestonesForRewardProcessor */ public function __construct( CanCreateBank $canCreateBank, CreatesBank $createsBank, CreatesBankLog $createsBankLog, FetchesCompany $fetchesCompany, CheckMilestonesForRewardProcessor $checkMilestonesForRewardProcessor ) { $this->canCreateBank = $canCreateBank; $this->createsBank = $createsBank; $this->createsBankLog = $createsBankLog; $this->fetchesCompany = $fetchesCompany; $this->checkMilestonesForRewardProcessor = $checkMilestonesForRewardProcessor; } /** * @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 { $bank_object = new BankObject($request->input('company_id'), $request->input('account_type'), $request->input('bank_name'), $request->input('holder_name'), $request->input('account_no'), $request->input('bank_branch'), $request->input('swift'), $request->input('snap'), $request->input('country_id'), $request->input('reference')); $this->canCreateBank->passes($bank_object); $bank = $this->createsBank->execute($bank_object); // $bankLog = $this->createsBankLog->execute($bank); //cief todo: case study 4 voucherify // $company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]); // $user = $company->employees()->first(); // $this->checkMilestonesForRewardProcessor->execute($user, [Milestones::MILESTONE_4]); return $this->resourceResponse(new BankResource($bank)); } }