skip to Main Content

Laravel API Call to a member function createToken() on null

AuthController namespace AppHttpControllersApi; use AppHttpControllersController; use AppModelsUser; use AppHttpRequestsApiRegisterRequest; use IlluminateHttpRequest; use IlluminateSupportFacadesAuth; class AuthController extends Controller { public function signUp(RegisterRequest $request) { $data = $request->validated(); $user = User::create($data); Auth::attempt(['username'=>$data['username'], 'password'=>$data['password']]); $token = auth()->user()->createToken($data['username']); return response([ 'status' => 'success', 'username'…

VIEW QUESTION
Back To Top
Search