im learning laravel and i have a problem returning the old inputs to the form.
ERROR:
ErrorException in Request.php line 839:
Session store not set on request. (View: C:\wamp\www\test\resources\views\artigo.blade.php)
ROUTES
Route::post('/', function(){
$rules = array(
'title'=>'required|max:10',
'body'=>'required|max:4'
);
$validator = Validator::make($_POST,$rules);
if($validator->fails())
return Redirect::to('/')->withInput()->withErrors($validator->errors());
return 'yooo';
});
BLADE VIEW
<!DOCTYPE html>
<html>
<body>
<form method="post" action="/">
<input type="text" name="title" placeholder="titulo" value="{{ old('title') }}">
<input type="text" name="body" placeholder="body">
<input type="submit" value="go">
</form>
</body>
</html>
any help? i already try {!! old('title') !!} i assume the error is because when i load the form on route::get e dont have yet the old input..
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire