- fix problem with phone number attribute

This commit is contained in:
Kamil Niemczycki 2023-07-03 19:31:03 +02:00
parent e049990606
commit 5839ef2a54
Signed by: kamilniemczycki
GPG Key ID: 04D4E2012F969213

View File

@ -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';
}
}
}