From f55cb2e44f602cf7215e872ba66a62466c3ee9a4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Nov 2023 21:10:31 +0900 Subject: [PATCH] docs: add sample code --- user_guide_src/source/incoming/restful.rst | 8 ++++++++ user_guide_src/source/incoming/restful/003.php | 4 ---- user_guide_src/source/incoming/restful/011.php | 4 ---- user_guide_src/source/incoming/restful/017.php | 5 +++++ user_guide_src/source/incoming/restful/018.php | 7 +++++++ user_guide_src/source/incoming/restful/019.php | 5 +++++ user_guide_src/source/incoming/restful/020.php | 7 +++++++ 7 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 user_guide_src/source/incoming/restful/017.php create mode 100644 user_guide_src/source/incoming/restful/018.php create mode 100644 user_guide_src/source/incoming/restful/019.php create mode 100644 user_guide_src/source/incoming/restful/020.php diff --git a/user_guide_src/source/incoming/restful.rst b/user_guide_src/source/incoming/restful.rst index d40f27ff6e9f..6d111a9302e1 100644 --- a/user_guide_src/source/incoming/restful.rst +++ b/user_guide_src/source/incoming/restful.rst @@ -52,6 +52,10 @@ 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 @@ -124,6 +128,10 @@ 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 347fde94c649..6f255282622d 100644 --- a/user_guide_src/source/incoming/restful/003.php +++ b/user_guide_src/source/incoming/restful/003.php @@ -3,7 +3,3 @@ $routes->resource('photos', ['controller' => 'Gallery']); // Would create routes like: $routes->get('photos', '\App\Controllers\Gallery::index'); - -$routes->resource('photos', ['controller' => '\App\Gallery']); -// Would create routes like: -$routes->get('photos', '\App\Gallery::index'); diff --git a/user_guide_src/source/incoming/restful/011.php b/user_guide_src/source/incoming/restful/011.php index fc3a44b14229..e08078d47e31 100644 --- a/user_guide_src/source/incoming/restful/011.php +++ b/user_guide_src/source/incoming/restful/011.php @@ -3,7 +3,3 @@ $routes->presenter('photos', ['controller' => 'Gallery']); // Would create routes like: $routes->get('photos', '\App\Controllers\Gallery::index'); - -$routes->presenter('photos', ['controller' => '\App\Gallery']); -// Would create routes like: -$routes->get('photos', '\App\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');