Skip to content

Commit f46960d

Browse files
Merge branch 'release/1.0.2'
2 parents 70ef9b1 + 032c15c commit f46960d

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
66

77
## Unreleased
88

9+
## 1.0.2 (2018-08-26)
10+
11+
### Added
12+
13+
- Added example to readme intro
14+
15+
### Changed
16+
17+
- Changed Composer description
18+
919
## 1.0.1 (2018-08-20)
1020

1121
### Fixed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Easily convert Eloquent model boolean fields to dates and back
1+
# Automatically convert Eloquent model boolean attributes to dates (and back)
22

33
[![Latest stable release][version-badge]][link-packagist]
44
[![Software license][license-badge]](LICENSE.md)
@@ -10,7 +10,41 @@
1010
[![Follow @sebastiaanluca on Twitter][twitter-profile-badge]][link-twitter]
1111
[![Share this package on Twitter][twitter-share-badge]][link-twitter-share]
1212

13-
__Sets the date of fields to the current date and time if an inputted counterpart boolean field is true-ish.__ Ideal for those terms and conditions checkboxes on user registration pages! Now you know _when_ they were accepted and not just _if_ (GDPR anyone?).
13+
__Sets the date of an attribute to the current date and time if an inputted counterpart boolean attribute is true-ish.__
14+
15+
### Example
16+
17+
Say you've got a registration page for users where they need to accept your terms and perhaps can opt-in to certain features using checkboxes. With the new(-ish) GDPR privacy laws, you're somewhat required to not just keep track of the fact *if* they accepted those (or not), but also *when* they did.
18+
19+
**This package automatically converts those boolean fields to dates so you always know when something was accepted.**
20+
21+
User registration controller:
22+
23+
```php
24+
$input = $request->input();
25+
26+
$user = User::create([
27+
'has_accepted_terms_and_conditions' => $input['terms'],
28+
'allows_data_processing' => $input['data_processing'],
29+
'has_agreed_to_something' => $input['something'],
30+
]);
31+
```
32+
33+
Anywhere else in your code:
34+
35+
```php
36+
$user->has_accepted_terms_and_conditions;
37+
38+
/*
39+
* true or false (boolean)
40+
*/
41+
42+
$user->accepted_terms_and_conditions_at;
43+
44+
/*
45+
* 2018-05-10 16:24:22 (string or Carbon instance)
46+
*/
47+
```
1448

1549
## Table of contents
1650

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sebastiaanluca/laravel-boolean-dates",
33
"type": "library",
4-
"description": "Easily convert Eloquent model booleans to dates and back with Laravel Boolean Dates.",
4+
"description": "Automatically convert Eloquent model boolean attributes to dates (and back).",
55
"keywords": [
66
"bool",
77
"boolean",

0 commit comments

Comments
 (0)