I have the following Laravel 4.2 controller code in a store method:
if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } I've tested this code with var_dump and the $validator is definitely returning the correct error messages.
The errors however are not being passed to the view. When attempting var_dump($errors) on the view I get the following exception Undefined variable: errors.
I've also tried (by accident) var_dump($error)and it is of type object(Illuminate\Support\ViewErrorBag) however it does not contain any errors.
Does anyone know what the problem might be? Thanks in advance.
$errorsis shared view variable and it's always defined, unless you mess with theViewServiceProvider.var_dump($error)but I believe this is a typo. Happy New year guys.