2021-07-04 16:56:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Payment;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2021-08-22 05:15:56 +02:00
|
|
|
use App\Http\Views\MemberView;
|
2021-07-04 16:56:07 +02:00
|
|
|
use App\Member\Member;
|
|
|
|
use App\Member\MemberResource;
|
2021-08-22 05:15:56 +02:00
|
|
|
use Illuminate\Http\Request;
|
2021-07-04 16:56:07 +02:00
|
|
|
|
|
|
|
class PaymentController extends Controller
|
|
|
|
{
|
|
|
|
public function index(Request $request, Member $member) {
|
|
|
|
session()->put('menu', 'member');
|
|
|
|
session()->put('title', "Zahlungen für Mitglied {$member->fullname}");
|
|
|
|
|
|
|
|
$payload = app(MemberView::class)->index($request);
|
|
|
|
$payload['single'] = app(MemberView::class)->paymentIndex($member);
|
|
|
|
|
|
|
|
return \Inertia::render('member/Index', $payload);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function store(Request $request, Member $member) {
|
2021-10-30 00:50:03 +02:00
|
|
|
$member->createPayment($request->validate([
|
2021-07-04 16:56:07 +02:00
|
|
|
'nr' => 'required|numeric',
|
|
|
|
'subscription_id' => 'required|exists:subscriptions,id',
|
|
|
|
'status_id' => 'required|exists:statuses,id',
|
|
|
|
]));
|
|
|
|
|
2021-11-11 22:38:03 +01:00
|
|
|
return redirect()->back();
|
2021-07-04 16:56:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function edit(Member $member, Request $request, Payment $payment) {
|
|
|
|
session()->put('menu', 'member');
|
|
|
|
session()->put('title', "Zahlungen für Mitglied {$member->fullname}");
|
|
|
|
|
|
|
|
$payload = app(MemberView::class)->index($request);
|
|
|
|
$payload['single'] = app(MemberView::class)->paymentEdit($member, $payment);
|
|
|
|
|
|
|
|
return \Inertia::render('member/Index', $payload);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function update(Request $request, Member $member, Payment $payment) {
|
|
|
|
$payment->update($request->validate([
|
|
|
|
'nr' => 'required|numeric',
|
|
|
|
'subscription_id' => 'required|exists:subscriptions,id',
|
|
|
|
'status_id' => 'required|exists:statuses,id',
|
|
|
|
]));
|
|
|
|
|
2021-08-22 05:15:56 +02:00
|
|
|
return redirect()->back();
|
2021-07-04 16:56:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function destroy(Request $request, Member $member, Payment $payment) {
|
|
|
|
$payment->delete();
|
|
|
|
|
2021-08-22 05:15:56 +02:00
|
|
|
return redirect()->back();
|
2021-07-04 16:56:07 +02:00
|
|
|
}
|
|
|
|
}
|