- add CV management
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user