I'm adding a validation to my sign up form , the validate code is working but the errors don't shows up in the page
PHP code
public function postSignUp(Request $request)
{
$this->validate($request, [
'email'=> 'required|email|unique:users',
'first_name'=> 'required|max:120',
'password' => 'required|min:4'
]);
$email = $request['email'];
$first_name = $request['first_name'];
$password = bcrypt($request['password']);
$user = new User();
$user->email = $email;
$user->first_name = $first_name;
$user->password = $password;
$user->save();
Auth::Login($user);
return redirect()->route('dashboard');
}
Welcome.blade.php code
@section('content')
@if(count($errors) > 0)
<div class="row">
<div class="col-md-6">
<ul>
@foreach($errors->all() as $error)
<li>{{$error}}</li>
@endforeach
</ul>
</div>
</div>
@endif
the php code is working because if i tried to register with an email that already taken it wont register but the error is that errors are not showing up in the welcome page