Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit 0933556

Browse files
committed
Adding doc about custom purge rules. Closes #81
1 parent c477052 commit 0933556

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,19 @@ class User extends \LaravelBook\Ardent\Ardent {
343343
}
344344
```
345345

346+
You can also purge additional fields. The attribute `Ardent::$purgeFilters` is an array of closures to which you can add your custom rules. Those closures receive the attribute key as argument and should return `false` for attributes that should be purged. Like this:
347+
348+
```php
349+
function __construct() {
350+
parent::__construct();
351+
352+
$this->purgeFilters[] = function($key) {
353+
$purge = array('tempData', 'myAttribute');
354+
return ! in_array($key, $purge);
355+
};
356+
}
357+
```
358+
346359
<a name="secure"></a>
347360
## Automatically Transform Secure-Text Attributes
348361

0 commit comments

Comments
 (0)