Skip to content

Commit ab48d4e

Browse files
committed
Update documentation
1 parent 9b7f0b6 commit ab48d4e

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Laravel Redacted Model makes it easier to hide or modify fields on a modal based
77
Laravel Redacted Model can be installed using composer. Run the following command in your project.
88

99
```bash
10-
composer require langleyfoxall/laravel-redacted-modal
10+
composer require langleyfoxall/laravel-redacted-model
1111
```
1212

1313
If you have never used the Composer dependency manager before, head to the [Composer website](https://getcomposer.org/) for more information on how to get started.
@@ -59,6 +59,8 @@ class SensitiveModel extends RedactedModel
5959

6060
If you want to completely omit the field instead of redacting it you can set the `redact` variable on your model to false.
6161

62+
_Note: If `redactKeys` is set to true, when the model is serialised the keys of redacted fields will also be omitted._
63+
6264
```php
6365
class SensitiveModel extends RedactedModel
6466
{
@@ -99,4 +101,24 @@ class SensitiveModel extends RedactedModel
99101
...
100102

101103
$instanceOfRedactedModel->name // Returns K***y instead of Kathryn Janeway
102-
```
104+
```
105+
106+
### Enabling and disabling protection
107+
108+
If you want to temporarily disable field redaction or omission you can call `disableProtection()` on the model to disable protection and `enableProtection()` to re-enable it. This has to be used on a per-instance basis.
109+
110+
```php
111+
class SensitiveModel extends RedactedModel
112+
{
113+
protected $redacted = ['name'];
114+
}
115+
116+
...
117+
118+
$instanceOfRedactedModel->name // Returns [Hidden Data]
119+
120+
$instanceOfRedactedModel->disableProtection();
121+
122+
$instanceOfRedactedModel->name // Returns Reginald Barclay
123+
```
124+

0 commit comments

Comments
 (0)