/var/www/vhosts/ihelp.ro/httpdocs/src/Controller/Dashboard
NameSizeModeActions
DashboardController.php21390644editdlrm
GalleryImagesController.php36690644editdlrm
OrdersController.php38060644editdlrm
ProductFavoritesController.php65610644editdlrm
ProductsController.php63100644editdlrm
ProfilesController.php34670644editdlrm
UserAddressesController.php50090644editdlrm
UsersController.php24020644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/src/Controller/Dashboard/ProfilesController.php (3467B)
userAuth->uuid; if (!empty($uuid)) { $users = $this->Profiles->Users->find() ->where(['Users.is_active' => true, 'Users.uuid' => $uuid]) ->first(); $profile = $this->Profiles->find() ->contain(['Users']) ->where(['Users.is_active' => true, 'Profiles.user_id' => $this->userAuth->id]) ->first(); $address = $this->Profiles->Users->UserAddresses->find() ->contain(['Users']) ->where(['Users.is_active' => true, 'UserAddresses.user_id' => $this->userAuth->id, 'UserAddresses.is_default' => true]) ->order(['UserAddresses.id' => 'DESC']) ->first(); $addressCount = $this->Profiles->Users->UserAddresses->find() ->contain(['Users']) ->where(['Users.is_active' => true, 'UserAddresses.user_id' => $this->userAuth->id]) ->order(['UserAddresses.id' => 'DESC']) ->count(); $product = $this->Profiles->Users->Products->find() ->contain(['FeaturedImage', 'Users']) ->where(['Users.is_active' => true, 'Products.user_id' => $this->userAuth->id, 'Products.is_active' => true]) ->order(['Products.id' => 'DESC']) ->first(); $productCount = $this->Profiles->Users->Products->find() ->contain(['FeaturedImage', 'Users']) ->where(['Users.is_active' => true, 'Products.user_id' => $this->userAuth->id, 'Products.is_active' => true]) ->order(['Products.id' => 'DESC']) ->count(); } else { $this->Flash->error(__('A apărut o problemă. Vă rugăm să încercați din nou')); return $this->redirect(['prefix' => 'Dashboard', 'controller' => 'Profiles', 'action' => 'view']); } $this->set(compact('profile', 'address', 'addressCount', 'product', 'productCount')); } /** * Edit method */ public function edit() { $uuid = $this->userAuth->uuid; if (!empty($uuid)) { $profile = $this->Profiles->find() ->contain(['Users']) ->where(['Users.is_active' => true, 'Profiles.user_id' => $this->userAuth->id]) ->first(); if ($this->request->is(['patch', 'post', 'put'])) { $profile = $this->Profiles->patchEntity($profile, $this->request->getData(), ['validate' => 'default']); if ($this->Profiles->save($profile)) { $this->Flash->success(__('Profilul a fost salvat.')); return $this->redirect($this->referer()); } $this->Flash->error(__('Profilul nu a putut fi salvat. Vă rugăm să încercați din nou.')); } } else { $this->Flash->error(__('A apărut o problemă. Vă rugăm să încercați din nou')); return $this->redirect(['prefix' => 'Dashboard', 'controller' => 'Profiles', 'action' => 'view']); } $this->set(compact('profile')); } }