You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -152,34 +145,38 @@ return new class extends Migration {
152
145
153
146
### Saving dates
154
147
155
-
If a boolean date field's value is true, it'll be automatically converted to the current datetime:
148
+
If a boolean date field's value is true-ish, it'll be automatically converted to the current datetime. You can use anything like booleans, strings, positive integers, and so on.
All fields should now contain a datetime similar to `2018-05-10 16:24:22`.
171
166
172
-
Note that the date stored in the database column **is immutable, i.e. it's only set once**. Any following updates will not change the stored date(time), unless you update the date column manually or if you set it to `false` and back to `true`.
167
+
Note that the date stored in the database column **is immutable, i.e. it's only set once**. Any following updates will not change the stored date(time), unless you update the date column manually or if you set it to `false` and back to `true` (disabling, then enabling it).
168
+
169
+
For example:
173
170
174
171
```php
175
172
$user = new User;
176
173
177
-
$user->has_accepted_terms_and_conditions = true;
174
+
$user->has_accepted_terms = true;
178
175
$user->save();
179
176
180
177
// `accepted_terms_at` column will contain `2022-03-13 13:20:00`
181
178
182
-
$user->has_accepted_terms_and_conditions = true;
179
+
$user->has_accepted_terms = true;
183
180
$user->save();
184
181
185
182
// `accepted_terms_at` column will still contain the original `2022-03-13 13:20:00` date
@@ -192,13 +189,12 @@ Of course you can also remove the saved date and time, for instance if a user re
0 commit comments