From 5839ef2a54da900abb59f6e6e3a252d5f59117e1 Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Mon, 3 Jul 2023 19:31:03 +0200 Subject: [PATCH] - fix problem with phone number attribute --- app/Models/CV.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Models/CV.php b/app/Models/CV.php index ad6b984..669472a 100644 --- a/app/Models/CV.php +++ b/app/Models/CV.php @@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Database\Eloquent\Relations\HasOne; /** * @property int $id @@ -33,7 +32,7 @@ class CV extends Model protected function phoneNumber(): Attribute { return Attribute::make( - get: fn (mixed $value): ?string => str_replace(' ', '', $value ?? ''), + get: fn (mixed $value, array $attributes): ?string => str_replace(' ', '', $attributes['phone_number'] ?? ''), ); } @@ -53,4 +52,4 @@ class CV extends Model { return 'token'; } -} +} \ No newline at end of file