-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41f4a34
commit 4c7c389
Showing
4 changed files
with
94 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ Contents | |
|
||
index | ||
installation | ||
quick-start | ||
basic-usage | ||
customizing-templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Quick Start | ||
----------- | ||
|
||
You are busy, and you just want to ``get things done™``, so let's get going. | ||
|
||
After :doc:`installation<installation>`, you are ready to CRUD-ify your app. | ||
|
||
App Controller | ||
~~~~~~~~~~~~~~ | ||
|
||
First, configure the `Crud <http://crud.readthedocs.org/en/latest/quick-start.html>`_ plugin. | ||
|
||
Configuring the AppController | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If you haven't configured the CRUD plugin already, add the following lines to your | ||
``src/Controller/AppController.php`` file | ||
|
||
.. code-block:: php | ||
<?php | ||
namespace App\Controller; | ||
class AppController extends \Cake\Controller\Controller | ||
{ | ||
use \Crud\Controller\ControllerTrait; | ||
public function initialize() | ||
{ | ||
parent::initialize(); | ||
$this->loadComponent('RequestHandler'); | ||
$this->loadComponent('Flash'); | ||
$this->viewClass = 'CrudView\View\CrudView'; | ||
$this->loadComponent('Crud.Crud', [ | ||
'actions' => [ | ||
'Crud.Index', | ||
'Crud.View', | ||
'Crud.Add', | ||
'Crud.Edit', | ||
'Crud.Delete', | ||
'Crud.Lookup', | ||
], | ||
'listeners' => [ | ||
// New listeners that need to be added: | ||
'CrudView.View', | ||
'Crud.Redirect', | ||
'Crud.RelatedModels', | ||
'CrudView.Search', | ||
] | ||
]); | ||
} | ||
} | ||
If you are familair with the CRUD plugin already, you will immediately understand | ||
that Crud view is simply a listener for the events generated by the plugin. If | ||
this is new to you, don't worry, it will be explained in the following sections. | ||
|
||
Using It In Your Controllers | ||
---------------------------- | ||
|
||
Any controller inheriting from ``AppController`` will automatically implement | ||
the specified actions loaded int the ``CRUD`` component configuration. | ||
Therefore, you can just leave your controller code empty! | ||
|
||
.. code-block:: php | ||
<?php | ||
namespace App\Controller; | ||
class CategoriesController extends AppController | ||
{ | ||
// No code here, but we have all actions available to use! | ||
} | ||
View the Results | ||
---------------- | ||
|
||
You can now access your categories list by pointing your browser to | ||
``http://example.com/categories``. Browse around your new Admin interface for | ||
each of the controllers you have in your application. |