mardi 9 mai 2017

How to use return back()->withInput() in laravel 5

i always get error like this when i use withInput() function in return back() but when i dont use withInput() this error wont appear.

ErrorException in helpers.php line 469: htmlentities() expects parameter 1 to be string, array given

this the validation code

$validation = Validator::make($request->all(), [
    'name'         => 'required|unique:products', 
    'category_id'  => 'required', 
    'region'       => 'required', 
    'primary_image'=> 'required'
]);

if($validation->fails()) {
    return back()->withInput()
        ->with('error', 'Please upload the image!');

and for the view, this is the full trace code: http://ift.tt/2qMns9h

i want when the validation is fail, it will back with previous input. hope you can give me solution :) thankyou.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire