I'm new to laravel and I'm trying to query the database to check if phone number exist.But when i do so and test with postman it failed. Here is a sample code:
public function mobile_availability(Request $request ){
$number=customer::where('phone_number',$request->phone)->first();
if($number) { {
return response()->json([
'status' => 'success',
'message' => 'Mobile Number is available',
'data'=>$request->phone,
'is_available'=>'true'
]);
}else {
return response()->json([
'status' => 'error',
'message' => 'Mobile Number is missing. Please try again',
'is_available'=>'false'
], 401);
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire