Skip to content

Commit abe695c

Browse files
Update readme
1 parent 6365d51 commit abe695c

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

CHANGELOG.md

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

77
## Unreleased
88

9+
## 1.0.3 (2018-08-26)
10+
11+
### Changed
12+
13+
- Updated readme
14+
915
## 1.0.2 (2018-08-26)
1016

1117
### Added

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,17 @@ $user->accepted_terms_and_conditions_at;
7272

7373
## How to install
7474

75-
Add the package to your project using composer:
75+
**Add the package** to your project using composer:
7676

7777
```bash
7878
composer require sebastiaanluca/laravel-boolean-dates
7979
```
8080

81-
Require the `BooleanDates` trait in your Eloquent model, then add the `$booleanDates` and `$dates` (optional) fields:
81+
**Require the `BooleanDates` trait** in your Eloquent model, then add the `$booleanDates` and `$dates` (optional) fields:
8282

8383
```php
84+
<?php
85+
8486
use Illuminate\Database\Eloquent\Model;
8587
use SebastiaanLuca\BooleanDates\BooleanDates;
8688

@@ -110,7 +112,36 @@ class User extends Model
110112
}
111113
```
112114

113-
Adding the boolean dates _values_ to the `$dates` array is **optional**, but encouraged as it'll convert all your boolean datetimes to Carbon instances.
115+
Adding the boolean date fields to the `$dates` array is **optional**, but encouraged as it'll convert all your boolean datetimes to Carbon instances.
116+
117+
To wrap up, create a **migration** to create a new or alter your existing table and add the timestamp fields:
118+
119+
```php
120+
<?php
121+
122+
use Illuminate\Database\Migrations\Migration;
123+
use Illuminate\Database\Schema\Blueprint;
124+
use Illuminate\Support\Facades\Schema;
125+
126+
class AddAgreementFields extends Migration
127+
{
128+
/**
129+
* Run the migrations.
130+
*
131+
* @return void
132+
*/
133+
public function up() : void
134+
{
135+
Schema::table('users', function (Blueprint $table) {
136+
$table->timestamp('accepted_terms_at')->nullable();
137+
$table->timestamp('accepted_processing_at')->nullable();
138+
$table->timestamp('agreed_to_something_at')->nullable();
139+
});
140+
}
141+
}
142+
```
143+
144+
Note: the related boolean fields are dynamic and do not need database fields.
114145

115146
## How to use
116147

0 commit comments

Comments
 (0)