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 create(Member $member, Request $request) { session()->put('menu', 'member'); session()->put('title', "Zahlungen für Mitglied {$member->fullname}"); $payload = app(MemberView::class)->index($request); $payload['single'] = app(MemberView::class)->paymentCreate($member); return \Inertia::render('member/Index', $payload); } public function store(Request $request, Member $member) { $member->payments()->create($request->validate([ 'nr' => 'required|numeric', 'subscription_id' => 'required|exists:subscriptions,id', 'status_id' => 'required|exists:statuses,id', ])); return redirect()->route('member.payment.index', ['member' => $member]); } 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', ])); return redirect()->route('member.payment.index', ['member' => $member]); } public function destroy(Request $request, Member $member, Payment $payment) { $payment->delete(); return redirect()->route('member.payment.index', ['member' => $member]); } }