Posts

Showing posts with the label cakephp

Image upload and display not work- Cakephp

Image upload and display not work- Cakephp I'm trying to add upload image for every connected user But I can't upload to databse Error message : Cannot convert value of type array to string Edit : When I try update The User profile from (profile function) I get message : Notice (8): Uninitialized string offset: 0 [COREsrcViewHelperUrlHelper.php, line 174] But when I update the profile From the Users (edit function) works fine UsersController.php public function edit($id = null) { $this->viewBuilder()->setLayout('user'); $user = $this->Users->get($id, [ 'contain' => ]); if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->data['password'] == '') { unset($this->request->data['password']); } $user = $this->Users->patchEntity($user, $this->request->data); if ($this->Users->save($u...

Trying to modify the user access in CakePHP

Trying to modify the user access in CakePHP I'm new in CakePHP I don't know how to manage with user access. I want the user to be able to access more than login and registration page on my app if he's not logged in. Currently, he can access only these pages if he's not logged in. I want to deny access only for a certain page. I've used this function: public function beforeFilter(Event $event) { $this->Auth->allow(['Home', 'About']); } With this function the user can access Home and About(Home and About are .ctp files in the Pages folder from Template). But I don't know how to allow access to the pages from NewCars folder which is of course in Template. Problem is that this folder has a lot of pages and subfolders and it will take a lot to put each one of them into an array . P.S. The page that I want to deny access it is in anoher folder name UsedCars. Have you read this section? book.cakephp.org/3.0/en/controlle...