I am upgrading a cakephp 2.x project - I am trying to create the admin prefix in the routes.php file and when I go to test it out, I get an error - specifically a Missing Controller. Which didn’t make sense to me at first until I looked at the Suggestion on the page and it wants me to create an Admin folder in the src/Controllers folder and create another Controller file, I assume with all admin related functions.
Since this is an upgrade from CakePHP 2 - is there a way to create the admin Prefix and not create the admin controllers/subfolders?
Sounds like you’re looking for Prefix Routing?
Thank you for your reply.
Yes - I read through the prefix routing - I guess I didn’t communicate my question clearly.
If I follow the prefix routing in the Cake 4 Cookbook - it tells me to create a subfolder in my src/Controllers and call it Admin and then create another Controller file for admin functions, also the templates. I am upgrading a client app that is CakePHP 2.7 and I would like to keep the structure somewhat familiar for the client, (all functions in one Controller file, instead of separating the admin from the nonadmin functions) in case he wishes to make any changes.
So, is there a way to create an admin prefix and keep all the functions in one Controller - ie UsersController containing index, view, admin_edit and admin_add functions (all in one controller)?
Hopefully I was clear and concise this time.