Code Styling
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Models\Tenant;
|
||||
use App\Domains\Admin\Actions\UpdateTenantPayment\UpdateTenantPaymentAction;
|
||||
use App\Domains\Admin\Actions\UpdateTenantPayment\UpdateTenantPaymentRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -11,17 +12,20 @@ class ManagedTenantPaymentUpdateController extends CommonController
|
||||
{
|
||||
public function __invoke(string $slug, Request $request): JsonResponse
|
||||
{
|
||||
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||
$tenant = $this->adminTenants->findBySlug($slug);
|
||||
|
||||
$tenant->update([
|
||||
'account_iban' => $request->input('account_iban'),
|
||||
'account_bic' => $request->input('account_bic'),
|
||||
'account_name' => $request->input('account_name'),
|
||||
]);
|
||||
$action = new UpdateTenantPaymentAction(new UpdateTenantPaymentRequest(
|
||||
tenant: $tenant,
|
||||
accountIban: $request->input('account_iban'),
|
||||
accountBic: $request->input('account_bic'),
|
||||
accountName: $request->input('account_name'),
|
||||
));
|
||||
|
||||
$response = $action->execute();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Bezahldaten wurden gespeichert.',
|
||||
'status' => $response->success ? 'success' : 'error',
|
||||
'message' => $response->message,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user