1: | <?php |
2: | |
3: | namespace Aurora\System\Casts; |
4: | |
5: | use Illuminate\Contracts\Database\Eloquent\CastsAttributes; |
6: | use Illuminate\Support\Str; |
7: | use Aurora\System\Utils; |
8: | |
9: | class Encrypt implements CastsAttributes |
10: | { |
11: | public function get($model, $key, $value, $attributes) |
12: | { |
13: | return substr(Utils::DecryptValue($value), 6); |
14: | } |
15: | |
16: | public function set($model, $key, $value, $attributes) |
17: | { |
18: | return [$key => Utils::EncryptValue(Str::random(6) . $value)]; |
19: | } |
20: | } |
21: |