Skip to content

Commit 29559a3

Browse files
committed
docs: add about model() function
1 parent a490cc2 commit 29559a3

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

user_guide_src/source/general/modules.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,18 @@ Libraries are always instantiated by their fully-qualified class name, so no spe
218218
Models
219219
======
220220

221-
Models are always instantiated by their fully-qualified class name, so no special access is provided:
221+
If you instantiate models with ``new`` keyword by their fully-qualified class names, no special access is provided:
222222

223223
.. literalinclude:: modules/011.php
224224

225+
Model files are automatically discovered whenever using the :php:func:`model()` function that is always available.
226+
227+
.. note:: We don't recommend you use the same short classname in modules.
228+
229+
.. note:: ``model()`` finds the file in **app/Models/** when there is a class with the same shortname,
230+
even if you specify a fully qualified class name like ``model(\Acme\Blog\Model\PostModel::class)``.
231+
This is because ``model()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`Factories Example <factories-example>` for more information.
232+
225233
Views
226234
=====
227235

0 commit comments

Comments
 (0)