diff --git a/app/Http/Controllers/Frontend/ProfileController.php b/app/Http/Controllers/Frontend/ProfileController.php index f5a3092..65e1f46 100644 --- a/app/Http/Controllers/Frontend/ProfileController.php +++ b/app/Http/Controllers/Frontend/ProfileController.php @@ -43,37 +43,9 @@ class ProfileController extends Controller if ($validationMessage) { return response()->json(['status' => 400, 'message' => $validationMessage]); } - // dd($request->all()); + $user = User::where('id', $request->id)->first(); - - // dd($user,$user['profile_image'] ,$user->profile_image,$request->profile_image); - - - // return $user->getRawOriginal('profile_image'); - - // if ($request->has('profile_image')) { - // if (\File::exists(public_path('/uploads/profile/img/' . $user->getRawOriginal('profile_image') . ''))) { - // \File::delete(public_path('/uploads/profile/img/' . $user->getRawOriginal('profile_image') . '')); - // } - // $profileImageName = time() . '.' . $request->profile_image->extension(); - // $request->profile_image->move(public_path('/uploads/profile/img'), $profileImageName); - // $updateCompanyLogo = User::where('id', $request->id)->update([ - // 'profile_image' => $profileImageName, - // ]); - // } - // dd($request->profile_image); - - // dd($this->imageUpload($request->profile_image,$request->id)); $image = $request->has('profile_image') ? $this->imageUpload($request->profile_image, $request->id) : $user->getRawOriginal('profile_image'); - // if($request->has('profile_image')) - // { - // $image = $this->imageUpload($request->profile_image,$request->id); - // } - // else - // { - // $image = $user->profile_image; - // } - // dd($image); $addUser = User::where('id', $request->id)->update([ 'name' => $request->name, @@ -110,9 +82,9 @@ class ProfileController extends Controller $validator = Validator::make($request->all(), [ 'name' => 'required', - 'email' => 'required', - 'contact_number' => 'required|min:10|max:10|unique:users,contact_number,' . $request->user()->id . '', - // 'profile_image' => 'required', + // 'email' => 'required', + // 'contact_number' => 'required|min:10|max:10|unique:users,contact_number,' . $request->user()->id . '', + 'profile_image' => 'image|mimes:jpeg,jpg,png|max:2000', 'address' => 'required' ], [ 'required' => 'The :attribute field must be required', @@ -127,22 +99,26 @@ class ProfileController extends Controller } $user = User::find($request->user()->id); - if ($request->has('profile_image')) { - if (\File::exists(public_path('/uploads/profile/img/' . $user->profile_image . ''))) { - \File::delete(public_path('/uploads/profile/img/' . $user->profile_image . '')); - } - $profileImageName = time() . '.' . $request->profile_image->extension(); - $request->profile_image->move(public_path('/uploads/profile/img'), $profileImageName); - $updateCompanyLogo = User::where('id', $request->user()->id)->update([ - 'profile_image' => $profileImageName, - ]); - } - + // if ($request->has('profile_image')) { + // if (\File::exists(public_path('/uploads/profile/img/' . $user->profile_image . ''))) { + // \File::delete(public_path('/uploads/profile/img/' . $user->profile_image . '')); + // } + // // dd('inside'); + // $profileImageName = time() . '.' . $request->profile_image->extension(); + // $request->profile_image->move(public_path('/uploads/profile/img'), $profileImageName); + // $updateCompanyLogo = User::where('id', $request->user()->id)->update([ + // 'profile_image' => $profileImageName, + // ]); + // } + // dd($user); + $image = $request->has('profile_image') ? $this->imageUpload($request->profile_image, $request->user()->id) : $user->getRawOriginal('profile_image'); + // dd($image); $addUser = User::where('id', $request->user()->id)->update([ 'name' => $request->name, - 'email' => $request->email, - 'contact_number' => $request->contact_number, - 'address' => $request->address + // 'email' => $request->email, + // 'contact_number' => $request->contact_number, + 'address' => $request->address, + 'profile_image' => $image, ]); if ($addUser) { return response()->json(['status' => 200, 'message' => 'Details Updated Successfully!']); diff --git a/app/helper.php b/app/helper.php index 59f1fe8..e35af68 100644 --- a/app/helper.php +++ b/app/helper.php @@ -41,10 +41,14 @@ function imagePath($path = null) { $finalPath = "https://jerichoalternatives.in/"; } - if(env('APP_ENV') == 'local') + if(env('APP_ENV') == 'staging') { $finalPath = "https://staging.jerichoalternatives.in/"; } + if(env('APP_ENV') == 'local') + { + $finalPath = "http://localhost/jericho_28_march/"; + } return $finalPath.$path; } diff --git a/public/uploads/profile/img/1711693296.jpg b/public/uploads/profile/img/1711693296.jpg new file mode 100644 index 0000000..21e241c Binary files /dev/null and b/public/uploads/profile/img/1711693296.jpg differ diff --git a/public/uploads/profile/img/1711694482.jpg b/public/uploads/profile/img/1711694482.jpg new file mode 100644 index 0000000..e22ed82 Binary files /dev/null and b/public/uploads/profile/img/1711694482.jpg differ diff --git a/public/uploads/profile/img/1711694856.jpg b/public/uploads/profile/img/1711694856.jpg new file mode 100644 index 0000000..e22ed82 Binary files /dev/null and b/public/uploads/profile/img/1711694856.jpg differ diff --git a/public/uploads/profile/img/1711695168.jpg b/public/uploads/profile/img/1711695168.jpg new file mode 100644 index 0000000..e22ed82 Binary files /dev/null and b/public/uploads/profile/img/1711695168.jpg differ diff --git a/public/uploads/profile/img/1711695305.jpg b/public/uploads/profile/img/1711695305.jpg new file mode 100644 index 0000000..e22ed82 Binary files /dev/null and b/public/uploads/profile/img/1711695305.jpg differ diff --git a/public/uploads/profile/img/1711695308.jpg b/public/uploads/profile/img/1711695308.jpg new file mode 100644 index 0000000..e22ed82 Binary files /dev/null and b/public/uploads/profile/img/1711695308.jpg differ diff --git a/public/uploads/profile/img/1711695309.jpg b/public/uploads/profile/img/1711695309.jpg new file mode 100644 index 0000000..e22ed82 Binary files /dev/null and b/public/uploads/profile/img/1711695309.jpg differ diff --git a/routes/api.php b/routes/api.php index 063eff4..8352f6f 100644 --- a/routes/api.php +++ b/routes/api.php @@ -160,7 +160,7 @@ Route::group(['middleware' => ['auth:sanctum']], function () { Route::get('get-user', [AuthController::class, 'getUser']); Route::post("update-profile", [ProfileController::class, 'updateAPI']); Route::post('logout', [AuthController::class, 'userLogout']); - Route::post("update-profile", [ProfileController::class, 'updateAPI']); + // Route::post("update-profile", [ProfileController::class, 'updateAPI']); Route::post("personal-information-kyc", [AccountsController::class, 'personalInformationKYC']); Route::post("location-information-kyc", [AccountsController::class, 'locationInformationKYC']); Route::post("pan-aadhar-kyc", [AccountsController::class, 'panAadharInformationKYC']);