1 | <?php |
||
2 | |||
3 | namespace Mews\Purifier\Casts; |
||
4 | |||
5 | use Illuminate\Contracts\Database\Eloquent\CastsAttributes; |
||
6 | |||
7 | class CleanHtml implements CastsAttributes |
||
8 | { |
||
9 | use WithConfig; |
||
10 | |||
11 | /** |
||
12 | * Clean the HTML when casting the given value. |
||
13 | * |
||
14 | * @param \Illuminate\Database\Eloquent\Model $model |
||
15 | * @param string $key |
||
16 | * @param mixed $value |
||
17 | * @param array $attributes |
||
18 | * @return array |
||
19 | */ |
||
20 | public function get($model, $key, $value, $attributes) |
||
21 | { |
||
22 | return clean($value, $this->config); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Prepare the given value for storage by cleaning the HTML. |
||
27 | * |
||
28 | * @param \Illuminate\Database\Eloquent\Model $model |
||
29 | * @param string $key |
||
30 | * @param array $value |
||
31 | * @param array $attributes |
||
32 | * @return string |
||
33 | */ |
||
34 | public function set($model, $key, $value, $attributes) |
||
35 | { |
||
36 | return clean($value, $this->config); |
||
0 ignored issues
–
show
|
|||
37 | } |
||
38 | } |
||
39 |