- add CV management

This commit is contained in:
2023-06-16 13:41:39 +02:00
parent 9518d6a811
commit 390c5b8087
8 changed files with 173 additions and 3 deletions

View File

@@ -4,11 +4,13 @@ declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $id
* @property string $token
* @property string $recipient
* @property string $email
* @property string $phoneNumber
@@ -25,4 +27,23 @@ class CV extends Model
'locations' => 'array',
'views' => 'integer',
];
protected function phoneNumber(): Attribute
{
return Attribute::make(
get: fn (mixed $value): ?string => str_replace(' ', '', $value ?? ''),
);
}
protected function formattedPhoneNumber(): Attribute
{
return Attribute::make(
get: fn (mixed $value, array $attributes): ?string => $attributes['phone_number'] ?? '',
);
}
public function getRouteKeyName(): string
{
return 'token';
}
}