Файловый менеджер - Редактировать - /home/clickysoft/public_html/somni.clickysoft.net/app/Http/Controllers/ProfileController.php
Назад
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Repositories\UserRepository; use App\Interfaces\UserRepositoryInterface; use App\Http\Requests\Landlord\UpdateProfileRequest; use App\Http\Requests\Landlord\ChangePasswordRequest; use App\Repositories\LandlordRepository; use App\Interfaces\LandlordRepositoryInterface; use App\Interfaces\TenantRepositoryInterface; use App\Repositories\TenantRepository; use Illuminate\Support\Facades\Hash; class ProfileController extends Controller { private UserRepositoryInterface $userInterfaceObj; //User Interface Object private LandlordRepositoryInterface $landlordInterfaceObj; private TenantRepositoryInterface $tenantInterfaceObj; public function __construct(UserRepository $userRepo, LandlordRepository $landlordRepo, TenantRepository $tenantRepo) { $this->userInterfaceObj = $userRepo; $this->landlordInterfaceObj = $landlordRepo; $this->tenantInterfaceObj = $tenantRepo; } public function index() { $user = auth()->user(); return view('profile.edit', compact('user')); } public function update(UpdateProfileRequest $request) { $user = auth()->user(); $user_update = $this->userInterfaceObj->updateUser($request, $user); if ($request->bio || $request->company_phone || $request->mailing_address) { $this->userInterfaceObj->updateUserInfo($user, $request); } if ($user_update) { return redirect()->route('edit.profile')->with('success', 'Your Profile has been updated successfully.'); } return redirect()->route('edit.profile')->with('error', 'Error updating profile.'); } public function changeShow() { $user = auth()->user(); $verify = $this->userInterfaceObj->checkVerification($user); if ($verify['flag']) { return view('profile.password', compact('user'))->with('verification', 'Please verify your account. It will be deactivated in ' . $verify['days'] . ' days.'); } return view('profile.password', compact('user')); } public function updatePassword(ChangePasswordRequest $request) { $user = $this->userInterfaceObj->getUserByKey('email', auth()->user()->email); $user->password = Hash::make($request->new_password); $user->save(); return redirect()->route('change.password.show')->with('success', 'Your password has been updated successfully.'); } public function emailEnable(){ $user = auth()->user(); $updateOrCreate = $this->userInterfaceObj->storeOrUpdateEmailNotification($user,1); return $updateOrCreate; } public function emailDisable(){ $user = auth()->user(); $updateOrCreate = $this->userInterfaceObj->storeOrUpdateEmailNotification($user,0); return $updateOrCreate; } public function desktopEnable(){ $user = auth()->user(); $updateOrCreate = $this->userInterfaceObj->storeOrUpdateDesktopNotification($user,1); return $updateOrCreate; } public function desktopDisable(){ $user = auth()->user(); $updateOrCreate = $this->userInterfaceObj->storeOrUpdateDesktopNotification($user,0); return $updateOrCreate; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка