Answer the question
In order to leave comments, you need to log in
No laravel errors?
I have my UserController class, inherited from the base one (obviously).
Registered validate in the UserController class
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');
}
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
Route::get('/', function () {
return view('welcome');
});
Route::group(['middleware' => ['web']], function ()
{
Route::post('/signup', ['uses' => '[email protected]', 'as' => 'signup']);
Route::post('/signin', ['uses' => '[email protected]', 'as' => 'signin']);
Route::get('/dashboard', ['uses' => '[email protected]', 'as' => 'dashboard']);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question