@@ -740,21 +740,22 @@ See :ref:`Auto Routing in Controllers <controller-auto-routing-improved>` for mo
740
740
Configuration Options
741
741
=====================
742
742
743
- These options are available at the top of **app/Config/Routes .php **.
743
+ These options are available in the **app/Config/Routing .php ** file .
744
744
745
745
Default Controller
746
746
------------------
747
747
748
748
For Site Root URI
749
749
^^^^^^^^^^^^^^^^^
750
750
751
- When a user visits the root of your site (i.e., **example.com **) the controller to use is determined by the value set by
752
- the ``setDefaultController() `` method, unless a route exists for it explicitly.
751
+ When a user visits the root of your site (i.e., **example.com **) the controller
752
+ to use is determined by the value set to the ``$defaultController `` property,
753
+ unless a route exists for it explicitly.
753
754
754
- The default value for this is ``Home ``
755
- which matches the controller at **app/Controllers/Home.php **:
755
+ The default value for this is ``Home `` which matches the controller at
756
+ **app/Controllers/Home.php **: :
756
757
757
- .. literalinclude :: routing/047.php
758
+ public string $defaultController = 'Home';
758
759
759
760
For Directory URI
760
761
^^^^^^^^^^^^^^^^^
@@ -775,10 +776,10 @@ This works similar to the default controller setting, but is used to determine t
775
776
when a controller is found that matches the URI, but no segment exists for the method. The default value is
776
777
``index ``.
777
778
778
- In this example, if the user were to visit **example.com/products **, and a ``Products `` controller existed, the
779
- ``Products::getListAll() `` method would be executed:
779
+ In this example, if the user were to visit **example.com/products **, and a ``Products ``
780
+ controller existed, the ``Products::getListAll() `` method would be executed: :
780
781
781
- .. literalinclude :: routing/048.php
782
+ public string $defaultMethod = 'listAll';
782
783
783
784
.. important :: You cannot access the controller with the URI of the default method name.
784
785
In the example above, you can access **example.com/products **, but if you access **example.com/products/listall **, it will be not found.
@@ -868,19 +869,22 @@ See :ref:`Auto Routing (Legacy) in Controllers <controller-auto-routing-legacy>`
868
869
Configuration Options (Legacy)
869
870
==============================
870
871
871
- These options are available at the top of **app/Config/Routes .php **.
872
+ These options are available in the **app/Config/Routing .php ** file .
872
873
873
874
Default Controller (Legacy)
874
875
---------------------------
875
876
876
877
For Site Root URI (Legacy)
877
878
^^^^^^^^^^^^^^^^^^^^^^^^^^
878
879
879
- When a user visits the root of your site (i.e., example.com) the controller to use is determined by the value set by
880
- the `` setDefaultController() `` method, unless a route exists for it explicitly. The default value for this is ``Home ``
881
- which matches the controller at ** app/Controllers/Home.php **:
880
+ When a user visits the root of your site (i.e., ** example.com ** ) the controller
881
+ to use is determined by the value set to the ``$defaultController `` property,
882
+ unless a route exists for it explicitly.
882
883
883
- .. literalinclude :: routing/047.php
884
+ The default value for this is ``Home `` which matches the controller at
885
+ **app/Controllers/Home.php **::
886
+
887
+ public string $defaultController = 'Home';
884
888
885
889
For Directory URI (Legacy)
886
890
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -898,10 +902,10 @@ This works similar to the default controller setting, but is used to determine t
898
902
when a controller is found that matches the URI, but no segment exists for the method. The default value is
899
903
``index ``.
900
904
901
- In this example, if the user were to visit **example.com/products **, and a ``Products `` controller existed, the
902
- ``Products::listAll() `` method would be executed:
905
+ In this example, if the user were to visit **example.com/products **, and a ``Products ``
906
+ controller existed, the ``Products::listAll() `` method would be executed: :
903
907
904
- .. literalinclude :: routing/048.php
908
+ public string $defaultMethod = 'listAll';
905
909
906
910
Confirming Routes
907
911
*****************
0 commit comments