app/Http/Controllers/Api/v1/AdminController.php
/**
     * Update User Profile
     * @param Request $request
     * @return JsonResponse
     */
Update User Profile
@param Request $request
@return JsonResponse
Update User Profile @param Request $request @return JsonResponse
public function updateProfile(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required|max:255',
            'mobile' => "nullable|unique:Users,mobile",
            'image' => 'nullable|image|max:1999'
        ]);
        if (auth()->user()) {
            $User_ad = auth()->user()->id;
            $user = User::query()->find($User_ad);
            $user->mobile = $request->mobile;
            $user->name = $request->name;
            $user->country = $request->country;
            if ($request->hasFile('image')) {
                $image = Helper::save_file($request->image, 'user');
                $user->image = $image;
            }
            if ($user->save()) {
                return response()->json(array('message' => 'Profile Updated', 'error' => false), 500);
            }
        }
        return response()->json(array('message' => 'Something Went Wrong', 'error' => true), 500);
    }
public function updateProfile ( Request $ request ) { $ validatedData = $ request -> validate ( [ 'name' => 'required|max:255' , 'mobile' => " nullable|unique:Users,mobile " , 'image' => 'nullable|image|max:1999' ] ) ; if ( auth ( ) -> user ( ) ) { $ User_ad = auth ( ) -> user ( ) -> id ; $ user = User :: query ( ) -> find ( $ User_ad ) ; $ user -> mobile = $ request -> mobile ; $ user -> name = $ request -> name ; $ user -> country = $ request -> country ; if ( $ request -> hasFile ( 'image' ) ) { $ image = Helper :: save_file ( $ request -> image , 'user' ) ; $ user -> image = $ image ; } if ( $ user -> save ( ) ) { return response ( ) -> json ( array ( 'message' => 'Profile Updated' , 'error' => false ) , 500 ) ; } } return response ( ) -> json ( array ( 'message' => 'Something Went Wrong' , 'error' => true ) , 500 ) ; }
Update User Profile
 @param Request $request
 @return JsonResponse
Update User Profile @param Request $request @return JsonResponse