Or anyone can give advice :)
Feb 2, 2021
3
Level 1
Fortify and API
Hello, this is my first question, I have to make fortify and auth-api work together. I am now sending a request to the API in order to register the user, but I cannot get App \ Models \ User, what fortify need All I get is User Object Is there someone who can help
frontend-fortify:
public function create(array $input) {
self::$password = $this->passwordGenerate();
Validator::make($input, [
'firstname' => ['required', 'string', 'max:255'],
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'email:dns'],
])->validate();
$input['password'] = Hash::make(self::$password);
$client = new ApiAuthenticationSystemController();
$newUser = $client->responseEmsApiData('register/', $input);
$this->sendUserInfoEmail($newUser->email, $newUser->id, self::$password);
dd($newUser);
return redirect()->route('login');
backend-API:
public function register(Request $request): User {
$user = User::create([
'name' =>$request->get('name'),
'firstname' => $request->get('firstname'),
'email' => $request->get('email'),
'password' => $request->input('password'),
]);
//return successful response
return User::find($user['id']);
Please or to participate in this conversation.