@@ -690,8 +690,12 @@ class AsJson implements CastsAttributes
690
690
* @param array<string , mixed > $attributes
691
691
* @return array<string , mixed >
692
692
*/
693
- public function get(Model $model, string $key, mixed $value, array $attributes): array
694
- {
693
+ public function get(
694
+ Model $model,
695
+ string $key,
696
+ mixed $value,
697
+ array $attributes,
698
+ ): array {
695
699
return json_decode($value, true);
696
700
}
697
701
@@ -700,8 +704,12 @@ class AsJson implements CastsAttributes
700
704
*
701
705
* @param array<string , mixed > $attributes
702
706
*/
703
- public function set(Model $model, string $key, mixed $value, array $attributes): string
704
- {
707
+ public function set(
708
+ Model $model,
709
+ string $key,
710
+ mixed $value,
711
+ array $attributes,
712
+ ): string {
705
713
return json_encode($value);
706
714
}
707
715
}
@@ -757,8 +765,12 @@ class AsAddress implements CastsAttributes
757
765
*
758
766
* @param array<string , mixed > $attributes
759
767
*/
760
- public function get(Model $model, string $key, mixed $value, array $attributes): Address
761
- {
768
+ public function get(
769
+ Model $model,
770
+ string $key,
771
+ mixed $value,
772
+ array $attributes,
773
+ ): Address {
762
774
return new Address(
763
775
$attributes['address_line_one'],
764
776
$attributes['address_line_two']
@@ -771,8 +783,12 @@ class AsAddress implements CastsAttributes
771
783
* @param array<string , mixed > $attributes
772
784
* @return array<string , string >
773
785
*/
774
- public function set(Model $model, string $key, mixed $value, array $attributes): array
775
- {
786
+ public function set(
787
+ Model $model,
788
+ string $key,
789
+ mixed $value,
790
+ array $attributes,
791
+ ): array {
776
792
if (! $value instanceof Address) {
777
793
throw new InvalidArgumentException('The given value is not an Address instance.');
778
794
}
@@ -829,8 +845,12 @@ Therefore, you may specify that your custom cast class will be responsible for s
829
845
*
830
846
* @param array<string , mixed > $attributes
831
847
*/
832
- public function serialize(Model $model, string $key, mixed $value, array $attributes): string
833
- {
848
+ public function serialize(
849
+ Model $model,
850
+ string $key,
851
+ mixed $value,
852
+ array $attributes,
853
+ ): string {
834
854
return (string) $value;
835
855
}
836
856
```
@@ -870,8 +890,12 @@ class AsHash implements CastsInboundAttributes
870
890
*
871
891
* @param array<string , mixed > $attributes
872
892
*/
873
- public function set(Model $model, string $key, mixed $value, array $attributes): string
874
- {
893
+ public function set(
894
+ Model $model,
895
+ string $key,
896
+ mixed $value,
897
+ array $attributes,
898
+ ): string {
875
899
return is_null($this->algorithm)
876
900
? bcrypt($value)
877
901
: hash($this->algorithm, $value);
@@ -977,16 +1001,24 @@ class Address implements Castable
977
1001
{
978
1002
return new class implements CastsAttributes
979
1003
{
980
- public function get(Model $model, string $key, mixed $value, array $attributes): Address
981
- {
1004
+ public function get(
1005
+ Model $model,
1006
+ string $key,
1007
+ mixed $value,
1008
+ array $attributes,
1009
+ ): Address {
982
1010
return new Address(
983
1011
$attributes['address_line_one'],
984
1012
$attributes['address_line_two']
985
1013
);
986
1014
}
987
1015
988
- public function set(Model $model, string $key, mixed $value, array $attributes): array
989
- {
1016
+ public function set(
1017
+ Model $model,
1018
+ string $key,
1019
+ mixed $value,
1020
+ array $attributes,
1021
+ ): array {
990
1022
return [
991
1023
'address_line_one' => $value->lineOne,
992
1024
'address_line_two' => $value->lineTwo,
0 commit comments