@@ -42,7 +42,7 @@ protected function decodeVirtualColumn(): void
4242 ['encrypted ' , 'encrypted:array ' , 'encrypted:collection ' , 'encrypted:json ' , 'encrypted:object ' ], // Default encrypted castables
4343 );
4444
45- foreach ($ this ->getAttribute ($ this -> getDataColumn ()) ?? [] as $ key => $ value ) {
45+ foreach ($ this ->getAttribute (static :: getDataColumn ()) ?? [] as $ key => $ value ) {
4646 $ attributeHasEncryptedCastable = in_array (data_get ($ this ->getCasts (), $ key ), $ encryptedCastables );
4747
4848 if ($ attributeHasEncryptedCastable && $ this ->valueEncrypted ($ value )) {
@@ -54,7 +54,7 @@ protected function decodeVirtualColumn(): void
5454 $ this ->syncOriginalAttribute ($ key );
5555 }
5656
57- $ this ->setAttribute ($ this -> getDataColumn (), null );
57+ $ this ->setAttribute (static :: getDataColumn (), null );
5858
5959 $ this ->dataEncoded = false ;
6060 }
@@ -65,8 +65,8 @@ protected function encodeAttributes(): void
6565 return ;
6666 }
6767
68- $ dataColumn = $ this -> getDataColumn ();
69- $ customColumns = $ this -> getCustomColumns ();
68+ $ dataColumn = static :: getDataColumn ();
69+ $ customColumns = static :: getCustomColumns ();
7070 $ attributes = array_filter ($ this ->getAttributes (), fn ($ key ) => ! in_array ($ key , $ customColumns ), ARRAY_FILTER_USE_KEY );
7171
7272 // Remove data column from the attributes
@@ -166,19 +166,19 @@ public function runAfterListeners($event, $halt = true)
166166 public function getCasts ()
167167 {
168168 return array_merge (parent ::getCasts (), [
169- $ this -> getDataColumn () => 'array ' ,
169+ static :: getDataColumn () => 'array ' ,
170170 ]);
171171 }
172172
173173 /**
174174 * Get the name of the column that stores additional data.
175175 */
176- public function getDataColumn (): string
176+ public static function getDataColumn (): string
177177 {
178178 return 'data ' ;
179179 }
180180
181- public function getCustomColumns (): array
181+ public static function getCustomColumns (): array
182182 {
183183 return [
184184 'id ' ,
@@ -192,10 +192,10 @@ public function getCustomColumns(): array
192192 */
193193 public function getColumnForQuery (string $ column ): string
194194 {
195- if (in_array ($ column , $ this -> getCustomColumns (), true )) {
195+ if (in_array ($ column , static :: getCustomColumns (), true )) {
196196 return $ column ;
197197 }
198198
199- return $ this -> getDataColumn () . '-> ' . $ column ;
199+ return static :: getDataColumn () . '-> ' . $ column ;
200200 }
201201}
0 commit comments