Skip to content

Commit d6c83c6

Browse files
authored
Models have disable-able default timestamps
Mentioned that `created_at` and `updated_at` are appended to `$dates` as long as `$model->timestamps == true`.
1 parent 555a8b1 commit d6c83c6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

eloquent-mutators.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ In this example, the `setFirstNameAttribute` function will be called with the va
9999
<a name="date-mutators"></a>
100100
## Date Mutators
101101

102-
By default, Eloquent will convert the `created_at` and `updated_at` columns to instances of [Carbon](https://github.com/briannesbitt/Carbon), which extends the PHP `DateTime` class to provide an assortment of helpful methods. You may customize which dates are automatically mutated, and even completely disable this mutation, by overriding the `$dates` property of your model:
102+
By default, Eloquent will convert the `created_at` and `updated_at` columns to instances of [Carbon](https://github.com/briannesbitt/Carbon), which extends the PHP `DateTime` class to provide an assortment of helpful methods. You may add date attributes by setting the `$dates` property of your model:
103103

104104
<?php
105105

@@ -115,11 +115,11 @@ By default, Eloquent will convert the `created_at` and `updated_at` columns to i
115115
* @var array
116116
*/
117117
protected $dates = [
118-
'created_at',
119-
'updated_at',
120-
'deleted_at'
118+
'seen_at',
121119
];
122120
}
121+
122+
You may disable the default `created_at` and `updated_at` timestamps by setting the public `$timestamps` property of the model to `false`.
123123

124124
When a column is considered a date, you may set its value to a UNIX timestamp, date string (`Y-m-d`), date-time string, and of course a `DateTime` / `Carbon` instance, and the date's value will automatically be correctly stored in your database:
125125

0 commit comments

Comments
 (0)