app/Http/Controllers/api/PassportController.php
/**
     * Handles Registration Request
     *
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
Handles Registration Request
@param Request $request
@return \Illuminate\Http\JsonResponse
Handles Registration Request @param Request $request @return \ Illuminate \ Http \ JsonResponse
public function register(Request $request)
    {
        $this->validate($request, [
            'name' => 'required|min:3',
            'email' => 'required|email|unique:users',
            'password' => 'required|min:6|confirmed',
        ]);
        $user = User::create([
            'name' => $request->name,
            'email' => $request->email,
            'password' => bcrypt($request->password)
        ]);
        $user = User::find($user->id); 
        $token = $user->createToken('cookie')->accessToken;
        return response()->json(['user' => $user, 'token' => $token], 200);
    }
public function register ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required|min:3' , 'email' => 'required|email|unique:users' , 'password' => 'required|min:6|confirmed' , ] ) ; $ user = User :: create ( [ 'name' => $ request -> name , 'email' => $ request -> email , 'password' => bcrypt ( $ request -> password ) ] ) ; $ user = User :: find ( $ user -> id ) ; $ token = $ user -> createToken ( 'cookie' ) -> accessToken ; return response ( ) -> json ( [ 'user' => $ user , 'token' => $ token ] , 200 ) ; }
Handles Registration Request
 @param Request $request
 @return \Illuminate\Http\JsonResponse
Handles Registration Request @param Request $request @return \ Illuminate \ Http \ JsonResponse
//to make login and register user model same for mobile app