adrema/app/Payment/PaymentController.php

36 lines
943 B
PHP
Raw Normal View History

2021-07-04 16:56:07 +02:00
<?php
namespace App\Payment;
use App\Http\Controllers\Controller;
use App\Lib\Events\ClientMessage;
2021-07-04 16:56:07 +02:00
use App\Member\Member;
2022-02-12 15:33:16 +01:00
use Illuminate\Http\RedirectResponse;
2021-08-22 05:15:56 +02:00
use Illuminate\Http\Request;
2023-10-13 15:48:29 +02:00
use Illuminate\Http\Response;
2021-07-04 16:56:07 +02:00
class PaymentController extends Controller
{
2023-10-13 15:48:29 +02:00
public function update(Request $request, Member $member, Payment $payment): Response
2022-02-12 15:33:16 +01:00
{
2021-07-04 16:56:07 +02:00
$payment->update($request->validate([
2023-01-04 12:40:59 +01:00
'nr' => 'required',
2021-07-04 16:56:07 +02:00
'subscription_id' => 'required|exists:subscriptions,id',
'status_id' => 'required|exists:statuses,id',
]));
ClientMessage::make('Zahlung aktualisiert.')->shouldReload()->dispatch();
2023-10-13 15:48:29 +02:00
return response('');
2021-07-04 16:56:07 +02:00
}
2023-10-13 15:48:29 +02:00
public function destroy(Request $request, Member $member, Payment $payment): Response
2022-02-12 15:33:16 +01:00
{
2021-07-04 16:56:07 +02:00
$payment->delete();
ClientMessage::make('Zahlung gelöscht.')->shouldReload()->dispatch();
2023-10-13 15:48:29 +02:00
return response('');
2021-07-04 16:56:07 +02:00
}
}