rules() public method

Get the validation rules that apply to the request.
public rules ( ) : array
return array
コード例 #1
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $array = parent::rules();
     $array['nom_entreprise'] = 'required|unique:entreprises,nom';
     $array['description'] = 'max:2000';
     return $array;
 }
コード例 #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(RegisterRequest $request)
 {
     // Getting all data after success validation.
     //print_r($request->all());die;
     // do your stuff here.
     $validator = $this->validator($request->rules());
     $this->validate($request, $request->rules());
     return redirect()->guest('auth/home');
 }