Commit 72de33a
Add encrypted casts support + allow using the trait on multiple models (#14)
* Add encrypted casts test (wip)
* Handle and test 'encrypted' casts
* Add APP_KEY to phpunit.xml
* Update attribute casting in VirtualColumn
* Test casting of all default 'encrypted' castables
* Fix code style (php-cs-fixer)
* Handle custom castables in VirtualColumn
* Add custom encrypted castable
* Test custom encrypted castable, refactor test
* Move EncryptedCast class to VirtualColumnTest
* Correct expected/actual value order in assertions
* Break code style (testing)
* Fix code style (php-cs-fixer)
* Check Laravel CI version (testing)
* dd() Laravel version
* Delete dd()
* Delete get() and set() types
* Use non-lowercase custom cast class strings
* Check hasCast manually
* Correct encrypted castable logic
* Update src/VirtualColumn.php
* Use `$dataEncoded` bool instead of `$dataEncodingStatus` string
* Don't accept unused `$e`
* Refactor `encodeAttributes()`
* Use `$model->getCustomColumns()` instead of `static::getCustomColumns()`
* Use `$model` instead of `static` where possible
* Correct test
* Revert `static` -> `$model` changes
* Correct typo
* Refactor `$afterListeneres`
* Fix code style (php-cs-fixer)
* Make static things non-static in VirtualColumn
* Change method to non-static in test
* Add base class that uses VirtualColumn in tests
* Add encrypted castables docblock
* Fix merge
* Fix ParentModel change
* make $this and $model use clear and consistent
---------
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>1 parent 925249b commit 72de33a
4 files changed
Lines changed: 199 additions & 91 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 2 | + | |
| 3 | + | |
11 | 4 | | |
12 | 5 | | |
13 | 6 | | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
17 | 10 | | |
| 11 | + | |
18 | 12 | | |
19 | 13 | | |
20 | 14 | | |
| |||
24 | 18 | | |
25 | 19 | | |
26 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
17 | 26 | | |
18 | 27 | | |
19 | 28 | | |
20 | 29 | | |
21 | 30 | | |
22 | | - | |
23 | | - | |
24 | 31 | | |
25 | | - | |
| 32 | + | |
26 | 33 | | |
27 | | - | |
| 34 | + | |
28 | 35 | | |
29 | | - | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
36 | 55 | | |
37 | 56 | | |
38 | | - | |
| 57 | + | |
39 | 58 | | |
40 | | - | |
| 59 | + | |
41 | 60 | | |
42 | 61 | | |
43 | | - | |
| 62 | + | |
44 | 63 | | |
45 | | - | |
| 64 | + | |
46 | 65 | | |
47 | 66 | | |
48 | 67 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
52 | 71 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 72 | + | |
| 73 | + | |
56 | 74 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
60 | 79 | | |
61 | 80 | | |
62 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
63 | 85 | | |
64 | 86 | | |
65 | | - | |
| 87 | + | |
66 | 88 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 89 | + | |
| 90 | + | |
70 | 91 | | |
71 | | - | |
72 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
73 | 104 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
78 | 126 | | |
79 | 127 | | |
80 | 128 | | |
81 | 129 | | |
82 | | - | |
83 | | - | |
| 130 | + | |
| 131 | + | |
84 | 132 | | |
85 | 133 | | |
86 | 134 | | |
| |||
97 | 145 | | |
98 | 146 | | |
99 | 147 | | |
100 | | - | |
| 148 | + | |
101 | 149 | | |
102 | 150 | | |
103 | 151 | | |
| |||
115 | 163 | | |
116 | 164 | | |
117 | 165 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 166 | | |
124 | 167 | | |
125 | 168 | | |
126 | | - | |
| 169 | + | |
127 | 170 | | |
128 | 171 | | |
129 | 172 | | |
130 | 173 | | |
131 | 174 | | |
132 | 175 | | |
133 | | - | |
| 176 | + | |
134 | 177 | | |
135 | 178 | | |
136 | 179 | | |
137 | 180 | | |
138 | | - | |
| 181 | + | |
139 | 182 | | |
140 | 183 | | |
141 | 184 | | |
| |||
149 | 192 | | |
150 | 193 | | |
151 | 194 | | |
152 | | - | |
| 195 | + | |
153 | 196 | | |
154 | 197 | | |
155 | 198 | | |
156 | | - | |
| 199 | + | |
157 | 200 | | |
158 | 201 | | |
0 commit comments