So, I am following this Laravel 5 angular / tutorial using JSON testers. I ran into a problem.
Here is how it is written: create a user:
Route::post('/signup', function () { $credentials = Input::only('email', 'password','name'); try { $user = User::create($credentials); } catch (Exception $e) { return Response::json(['error' => 'User already exists.'], Illuminate\Http\Response::HTTP_CONFLICT); } $token = JWTAuth::fromUser($user); return Response::json(compact('token')); });
The problem is that User::create($credentials); does not encrypt the password, which means logins will always fail. I found this using the default Laravel login.
My question is: how do I create a new user that creates him correctly?
source share