-1

Good morinig everyone. Can you tell me how to use the old() function in laravel collective? - classical form:

<input type="text" name="username" value="{{old('username')}} />

But with laravelcollective form, I don't know how to do. Please help!!!

brombeer
  • 8,716
  • 5
  • 21
  • 27

2 Answers2

0

If you want to use old() in laravel collective form simply apply this method:

{{ Form::text('name',old('name'),['type'=>'text','class'=>'form-control','placeholder'=>'Name']) }}

Be noted that you can also use old() in Controller by below mentioned method:

$email = $request->old('name'); (but remember that you need to declare Request Object in your function parameter where you redirect after submit. eg: public function add(Request $request) {} )

0

hello Crispus Elischama, In my case, I am using this way...

{{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder'=>'Email']) }}

and use withInput() end of the route

return redirect()->back()->withInput();