adrema/app/Member/MemberController.php

38 lines
1.0 KiB
PHP
Raw Normal View History

2020-06-02 23:45:25 +02:00
<?php
namespace App\Member;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
2021-04-11 11:19:55 +02:00
use App\Gender;
use App\Fee;
2020-06-02 23:45:25 +02:00
class MemberController extends Controller
{
public function index(Request $request) {
2021-04-11 01:25:40 +02:00
session()->put('menu', 'member');
session()->put('title', 'Mitglieder');
return \Inertia::render('member/Index', [
2021-04-11 02:55:26 +02:00
'data' => MemberResource::collection(Member::search($request->query('search', null))->paginate(15))
2020-06-02 23:45:25 +02:00
]);
}
2021-04-11 11:19:55 +02:00
public function edit(Member $member, Request $request) {
session()->put('menu', 'member');
session()->put('title', 'Mitglied bearbeiten');
return \Inertia::render('member/Edit', [
'genders' => Gender::where('is_null', false)->get()->pluck('name', 'id'),
'fees' => Fee::get()->pluck('name', 'id'),
'data' => new MemberResource($member)
]);
}
public function update(Member $member, Request $request) {
$member->update($request->input());
return redirect()->route('member.index');
}
2020-06-02 23:45:25 +02:00
}