Skip to content

Commit 4d05510

Browse files
committed
docs: add section titles
1 parent d1709ca commit 4d05510

1 file changed

Lines changed: 29 additions & 16 deletions

File tree

user_guide_src/source/models/model.rst

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,54 +151,60 @@ potential mass assignment vulnerabilities.
151151

152152
.. note:: The ``$primaryKey`` field should never be an allowed field.
153153

154+
Dates
155+
-----
156+
154157
$useTimestamps
155-
--------------
158+
^^^^^^^^^^^^^^
156159

157160
This boolean value determines whether the current date is automatically added to all inserts
158161
and updates. If true, will set the current time in the format specified by ``$dateFormat``. This
159162
requires that the table have columns named **created_at**, **updated_at** and **deleted_at** in the appropriate
160163
data type.
161164

162165
$dateFormat
163-
-----------
166+
^^^^^^^^^^^
164167

165168
This value works with ``$useTimestamps`` and ``$useSoftDeletes`` to ensure that the correct type of
166169
date value gets inserted into the database. By default, this creates DATETIME values, but
167170
valid options are: ``'datetime'``, ``'date'``, or ``'int'`` (a PHP timestamp). Using **useSoftDeletes** or
168171
useTimestamps with an invalid or missing dateFormat will cause an exception.
169172

170173
$createdField
171-
-------------
174+
^^^^^^^^^^^^^
172175

173176
Specifies which database field to use for data record create timestamp.
174177
Leave it empty to avoid updating it (even if ``$useTimestamps`` is enabled).
175178

176179
$updatedField
177-
-------------
180+
^^^^^^^^^^^^^
178181

179182
Specifies which database field should use for keep data record update timestamp.
180183
Leave it empty to avoid update it (even ``$useTimestamps`` is enabled).
181184

182185
$deletedField
183-
-------------
186+
^^^^^^^^^^^^^
184187

185188
Specifies which database field should use for soft deletions. See :ref:`model-use-soft-deletes`.
186189

190+
Validation
191+
----------
192+
187193
$validationRules
188-
----------------
194+
^^^^^^^^^^^^^^^^
189195

190196
Contains either an array of validation rules as described in :ref:`validation-array`
191197
or a string containing the name of a validation group, as described in the same section.
192198
Described in more detail below.
193199

194200
$validationMessages
195-
-------------------
201+
^^^^^^^^^^^^^^^^^^^
196202

197203
Contains an array of custom error messages that should be used during validation, as
198204
described in :ref:`validation-custom-errors`. Described in more detail below.
199205

200206
$skipValidation
201-
---------------
207+
^^^^^^^^^^^^^^^
202208

203209
Whether validation should be skipped during all **inserts** and **updates**. The default
204210
value is ``false``, meaning that data will always attempt to be validated. This is
@@ -208,7 +214,7 @@ this model will never validate.
208214
.. _clean-validation-rules:
209215

210216
$cleanValidationRules
211-
---------------------
217+
^^^^^^^^^^^^^^^^^^^^^
212218

213219
Whether validation rules should be removed that do not exist in the passed data.
214220
This is used in **updates**.
@@ -220,23 +226,30 @@ You can also change the value by the ``cleanRules()`` method.
220226

221227
.. note:: Prior to v4.2.7, ``$cleanValidationRules`` did not work due to a bug.
222228

229+
Callbacks
230+
---------
231+
223232
$allowCallbacks
224-
---------------
233+
^^^^^^^^^^^^^^^
225234

226235
Whether the callbacks defined below should be used.
227236

228237
$beforeInsert
229-
-------------
238+
^^^^^^^^^^^^^
230239
$afterInsert
231-
------------
240+
^^^^^^^^^^^^
232241
$beforeUpdate
233-
-------------
242+
^^^^^^^^^^^^^
234243
$afterUpdate
235-
------------
244+
^^^^^^^^^^^^
245+
$beforeFind
246+
^^^^^^^^^^^
236247
$afterFind
237-
----------
248+
^^^^^^^^^^
249+
$beforeDelete
250+
^^^^^^^^^^^^^
238251
$afterDelete
239-
------------
252+
^^^^^^^^^^^^
240253

241254
These arrays allow you to specify callback methods that will be run on the data at the
242255
time specified in the property name.

0 commit comments

Comments
 (0)