0

我想在 postmann 中上传图像并希望它保存在数据库中。我可以随时打电话给数字参数。

public function profile( Request $request){
//return $user = Auth::user();
// validate if req is empty
$validator = Validator::make($request->all(), [
    'firstName' => 'required|string',
    'lastName' => 'required|string',
    'email' => 'required|string',
    'msisdn' => 'required|string',
    'ProfilePicture' => 'string',
    
]);

if($validator->fails()){
    return response()->json(['status' => 'Error', 'Error Code' => 'Invalid Number']);
}else{
$updatedData = \DB::table('subscribers')
    ->where('msisdn',$request->msisdn)
    ->update([
        'firstName' => $request->firstName,
        'lastName' => $request->lastName,
        'email' => $request->email,
        'ProfilePicture' => $request->ProfilePicture,
]);
$msisdn= \DB::table('subscribers')
->where('msisdn',$request->msisdn)->first();
return response()->json(['MSISDN' => $msisdn, 'status' => 'Successfully verify', 'errorCode' => '200']); } return $updatedData;    }
4

0 回答 0