/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $place_validation = Flyer::getPlacesStr(); // todo: remove this comment. // dd($place_validation); return ['street' => 'required', 'city' => 'required', 'postcode' => 'required', 'state' => 'required', 'price' => 'required|integer', 'description' => 'required', 'place' => ['regex:(uk|fr|au)']]; }
public function addPhoto($id, Request $request) { $this->validate($request, ['file' => 'required|mimes:jpg,jpeg,png,bmp,gif']); $photo = Photo::fromForm($request->file('file')); Flyer::find($id)->addPhoto($photo); flash()->overlay('Successfully saved', 'Photos have been saved', 'success'); return "Photos Uploaded"; }