validated(); $data['password'] = Str::random(8); try { $user = User::create($data); } catch (Throwable $exception) { return response() ->json($exception); } return response() ->json(['message' => 'Successfully created user ' . $user->firstname]); } public function getUser(Request $request, User $user) { return response() ->json(['status' => true]); } }