diff --git a/user_guide_src/source/incoming/restful.rst b/user_guide_src/source/incoming/restful.rst index 9240ac8b476d..6d111a9302e1 100644 --- a/user_guide_src/source/incoming/restful.rst +++ b/user_guide_src/source/incoming/restful.rst @@ -52,6 +52,12 @@ the controller that should be used: .. literalinclude:: restful/003.php +.. literalinclude:: restful/017.php + +.. literalinclude:: restful/018.php + +See also :ref:`controllers-namespace`. + Change the Placeholder Used =========================== @@ -122,6 +128,12 @@ the controller that should be used: .. literalinclude:: restful/011.php +.. literalinclude:: restful/019.php + +.. literalinclude:: restful/020.php + +See also :ref:`controllers-namespace`. + Change the Placeholder Used =========================== diff --git a/user_guide_src/source/incoming/restful/003.php b/user_guide_src/source/incoming/restful/003.php index 6610555f0a5f..6f255282622d 100644 --- a/user_guide_src/source/incoming/restful/003.php +++ b/user_guide_src/source/incoming/restful/003.php @@ -1,6 +1,5 @@ resource('photos', ['controller' => 'App\Gallery']); - +$routes->resource('photos', ['controller' => 'Gallery']); // Would create routes like: -$routes->get('photos', 'App\Gallery::index'); +$routes->get('photos', '\App\Controllers\Gallery::index'); diff --git a/user_guide_src/source/incoming/restful/011.php b/user_guide_src/source/incoming/restful/011.php index cbb6f13bdf85..e08078d47e31 100644 --- a/user_guide_src/source/incoming/restful/011.php +++ b/user_guide_src/source/incoming/restful/011.php @@ -1,6 +1,5 @@ presenter('photos', ['controller' => 'App\Gallery']); - +$routes->presenter('photos', ['controller' => 'Gallery']); // Would create routes like: -$routes->get('photos', 'App\Gallery::index'); +$routes->get('photos', '\App\Controllers\Gallery::index'); diff --git a/user_guide_src/source/incoming/restful/017.php b/user_guide_src/source/incoming/restful/017.php new file mode 100644 index 000000000000..853748f84527 --- /dev/null +++ b/user_guide_src/source/incoming/restful/017.php @@ -0,0 +1,5 @@ +resource('photos', ['controller' => '\App\Gallery']); +// Would create routes like: +$routes->get('photos', '\App\Gallery::index'); diff --git a/user_guide_src/source/incoming/restful/018.php b/user_guide_src/source/incoming/restful/018.php new file mode 100644 index 000000000000..6951d07b07b3 --- /dev/null +++ b/user_guide_src/source/incoming/restful/018.php @@ -0,0 +1,7 @@ +resource('photos', ['namespace' => '', 'controller' => Gallery::class]); +// Would create routes like: +$routes->get('photos', '\App\Controllers\Gallery::index'); diff --git a/user_guide_src/source/incoming/restful/019.php b/user_guide_src/source/incoming/restful/019.php new file mode 100644 index 000000000000..09885e7f0039 --- /dev/null +++ b/user_guide_src/source/incoming/restful/019.php @@ -0,0 +1,5 @@ +presenter('photos', ['controller' => '\App\Gallery']); +// Would create routes like: +$routes->get('photos', '\App\Gallery::index'); diff --git a/user_guide_src/source/incoming/restful/020.php b/user_guide_src/source/incoming/restful/020.php new file mode 100644 index 000000000000..ddd67cc22d93 --- /dev/null +++ b/user_guide_src/source/incoming/restful/020.php @@ -0,0 +1,7 @@ +presenter('photos', ['namespace' => '', 'controller' => Gallery::class]); +// Would create routes like: +$routes->get('photos', '\App\Controllers\Gallery::index'); diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index c509f807be87..646b66bd4ffc 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -83,6 +83,8 @@ You can supply multiple verbs that a route should match by passing them in as an Specifying Route Handlers ========================= +.. _controllers-namespace: + Controller's Namespace ----------------------