Reputation: 21
Although project work fine in local, when deploy on server found error. laravel 7 php version 7.4.13
ParseError: syntax error, unexpected 'Parser' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in file /var/www/html/laravel/vendor/lcobucci/jwt/src/Configuration.php on line 22
public function verifyOtp(Request $request)
{
$phoneno = $request->input('loginId');
$enteredOtp = $request->input('password');
$loginData = [
'login_id' => $phoneno,
'password' => $enteredOtp
];
// dd($loginData);
if (!auth()->attempt($loginData)) {
return response([
'message' => 'OTP incorrect!',
'status'=>0
]);
} else {
// dd("Here");
$accessToken = auth()->user()->createToken('authToken')->accessToken;
return response([
'user' =>auth()->user(),
'access_token' =>$accessToken,
'message'=>"Successfully login",
'status'=>1
]);
}
}
Upvotes: 0
Views: 1471
Reputation: 50491
You would need PHP 7.4+ to use the code base you currently have. The version of the package that the error is coming from uses features from PHP 7.4.
Upvotes: 2