Laravel validation not showing the default error messages -
Laravel validation not showing the default error messages -
i working on laravel project , having issues validation. default error messages dont appear instead see validation requirements this: http://gyazo.com/681e9d8e2e176a29d90db041354f7177
this code:
routes.php (i set code in here now)
route::filter('checklogin', function() { if(input::get('email') != ""){ //register $rules = array( 'username' => 'required|max:64|min:3|unique:users', 'password' => 'required|max:64|min:6', 'fname' => 'required|max:255|alpha', 'lname' => 'required|max:255|alpha', 'email' => 'required|max:255|email', 'phone' => 'max:24|min:9', 'zip' => 'required', 'street' => 'required|max:255|alpha', 'housenumber' => 'required|max:6|numeric', 'country' => 'required', 'avatar' => 'max:32' ); $validator = validator::make(input::all(), $rules); if($validator->fails()) { homecoming redirect::to('/')->withinput()->witherrors($rules); } }
});
this how code view:
<div class="fields"> <div class="field"> <i class="fa fa-user"></i> {{ form::text('username', null, ['placeholder' => 'username', 'tabindex' => 1]) }} {{ $errors->first('username') }} </div> <div class="field"> <i class="fa fa-lock"></i> {{ form::password('password', ['placeholder' => 'password', 'tabindex' => 2]) }} <a href="forgot" class="fa fa-question-circle login" title="forgot password?"></a> {{ $errors->first('password') }} </div> </div>
when validation fails, returning $rules
errors. alter line:
return redirect::to('/')->withinput()->witherrors($rules);
to this:
return redirect::to('/')->withinput()->witherrors($validator);
validation laravel messages
Comments
Post a Comment