コード例 #1
0
ファイル: FlyerRequest.php プロジェクト: siadev/laravel-tests
 /**
  * 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)']];
 }
コード例 #2
0
 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";
 }