mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-23 06:24:03 +00:00
admin suspend user's bank account - UI & API
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Banks\ControllersLogic;
|
||||
|
||||
use App\Http\Resources\BankResource;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
use App\Classes\Modules\Banks\Services\UpdatesBankStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateBankStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Update Bank Account Status',
|
||||
'message' => 'You have successfully updated the Bank Account Status'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
/** @var UpdatesBankStatus */
|
||||
private $updatesBankStatus;
|
||||
|
||||
/**
|
||||
* UpdateBankStatusLogic constructor.
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param UpdatesBankStatus $updatesBankStatus
|
||||
*/
|
||||
public function __construct(
|
||||
FetchesBank $fetchesBank,
|
||||
UpdatesBankStatus $updatesBankStatus
|
||||
)
|
||||
{
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->updatesBankStatus = $updatesBankStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 = $this->fetchesBank->execute(['id' => $request->route('id')]);
|
||||
|
||||
$bank_query = $this->updatesBankStatus->execute($bank, $request->input('status'));
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank_query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user