我正在开始使用流明。
这是我的web.php
文件
$router->group(['prefix' => 'api'], function () use ($router) {
$router->post('user', ['uses' => 'UserController@createUser']);
});
这是我的UserController.php
public function createUser(Request $request){
$this->validate($request, [
'username' => 'required',
'password' => 'required|min:3'
]);
$user = [
'username' => $request->username,
'password' => app('hash')->make($request->password),
'email' => $request->email,
'api_token' => 'asdfasd' //want should I put here
];
$user = User::create($user);
return response()->json($user, 201);
}
如何为正在注册的新用户创建新的api令牌?