validate([ 'name' => ['required','string','max:255'], 'text' => ['required','string','max:5000'], 'pic' => ['nullable','image','mimes:jpg,jpeg,png','max:4096'], 'bedingungen' => ['nullable','file','mimetypes:application/pdf','max:8192'], 'active' => ['sometimes','accepted'], 'time' => ['sometimes','accepted'], 'sdate' => ['nullable','date'], 'edate' => ['nullable','date','after_or_equal:sdate'], 'stime' => ['nullable','date_format:H:i'], 'etime' => ['nullable','date_format:H:i'], ]); if ($request->hasFile('pic')) { $data['pic_path'] = $request->file('pic')->store('bewerbungen/pics', 'public'); } if ($request->hasFile('bedingungen')) { $data['bedingungen_path'] = $request->file('bedingungen')->store('bewerbungen/bedingungen', 'public'); } $data['active'] = $request->boolean('active'); $data['time'] = $request->boolean('time'); // TODO: $bewerbung = Bewerbung::create($data); return redirect()->back()->with('success', 'Bewerbung gespeichert.'); } }