'EventForm Component', 'description' => 'No description provided yet...', ]; } public function defineProperties() { return []; } public function onSubmit(): JsonResponse { $rules = [ 'activity' => 'required|max:255', 'gender' => 'required|max:255', 'firstname' => 'required|max:255', 'lastname' => 'required|max:255', 'birthday' => 'required|date|before_or_equal:'.now()->format('Y-m-d'), 'address' => 'required|max:255', 'zip' => 'required|numeric', 'location' => 'required|max:255', 'phone' => 'required|max:255', 'email' => 'required|max:255|email', 'agegroup' => 'required|max:255', 'group' => 'nullable|max:255', 'agegroup_leader' => 'nullable|max:255', 'emergency_phone' => 'required|max:255', 'food_preferences' => 'array', 'misc' => '', 'foto' => '', ]; if ('Orga' === Input::get('activity')) { $rules['vorteam'] = 'in:Ja,Nein'; } $validator = Validator::make(Input::all(), $rules, [ 'vorteam.in' => 'Bitte gebe an, ob du am Vorteam teilnehmen willst.', ], Lang::get('zoomyboy.event::validation.attributes')); if ($validator->fails()) { return response()->json($validator->errors(), 422); } $participant = Participant::create(array_merge($validator->validated(), [ 'vorteam' => 'Ja' === Input::get('vorteam'), ])); // Mail::send('zoomyboy.event::mail.confirm', ['data' => $participant, 'until' => '1.9.2023', 'iban' => 'XXX', 'birthday' => $participant->birthday->format('d.m.Y')], function ($message) use ($participant) { // $message->to($participant->email, $participant->firstname.' '.$participant->lastname); // $message->subject('Deine Anmeldung fürs Bezirkslager'); // }); return response()->json([], 201); } }