Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit 5404e8f

Browse files
committed
Update and rename README.md to readme.md
1 parent 87ac4af commit 5404e8f

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

readme.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# attribute-purging
2+
Allows you to define what attributes in your Eloquent Model which should be not be inserted into the database.
3+
4+
## Installing
5+
6+
Install using Composer `composer require larapack/attribute-purging 1.*`.
7+
8+
## Usage
9+
10+
First add the trait `Purgeable` to your Eloquent Model.
11+
```
12+
<?php
13+
14+
namespace App;
15+
16+
use Larapack/AttributePurgin/Purgeable;
17+
18+
class User
19+
{
20+
use Purgeable;
21+
22+
/**
23+
* @var array List of attribute names which should be purged
24+
*/
25+
protected $purge = ['foo']; // set the attribute names you which to purge
26+
27+
//...
28+
}
29+
```
30+
31+
Test:
32+
```
33+
$user = new App\User;
34+
$user->foo = 'bar';
35+
$user->save(); // The attribute 'foo' will not be saved to the database.
36+
echo $user->foo; // Will still returns 'bar' as long you hold the same instance of the object.
37+
```

0 commit comments

Comments
 (0)