Adding a prefix
Prefixes are additional values prepended to the URL, which allow you to clearly separate collections of actions in your controllers. This is typically used to rapidly create an admin area for an application.
In this recipe, we'll create an inventory management area to a books
controller, where the standard actions will simply display details of books and the inventory area will be used to manage our books.
Getting ready
For this recipe, we'll need a table for our books, so create a table named books
by using the following SQL statement:
CREATE TABLE books ( id VARCHAR(36) NOT NULL, name VARCHAR(100), stock INT(4), created DATETIME, modified DATETIME, PRIMARY KEY(id) );
We'll then need some sample data, so run the following SQL statement to insert some books:
INSERT INTO books (id, name, stock, created, modified) VALUES ('635c460a-f230-4565-8378-7cae01314e03', 'CakePHP Application', 2, NOW(), NOW()), ('635c4638-c708-4171-985a...