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;
|
2021-04-11 11:44:51 +02:00
|
|
|
use App\Region;
|
|
|
|
use App\Country;
|
|
|
|
use App\Nationality;
|
|
|
|
use App\Confession;
|
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', [
|
2021-04-11 17:02:49 +02:00
|
|
|
'genders' => Gender::get()->pluck('name', 'id'),
|
2021-04-11 11:44:51 +02:00
|
|
|
'countries' => Country::get()->pluck('name', 'id'),
|
|
|
|
'regions' => Region::where('is_null', false)->get()->pluck('name', 'id'),
|
|
|
|
'nationalities' => Nationality::get()->pluck('name', 'id'),
|
|
|
|
'confessions' => Confession::where('is_null', false)->get()->pluck('name', 'id'),
|
2021-04-11 11:19:55 +02:00
|
|
|
'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
|
|
|
}
|