Last commit before showcase.
This commit is contained in:
@@ -12,12 +12,29 @@ class PersonPhone extends Model
|
||||
/** @use HasFactory<\Database\Factories\Person/PersonPhoneFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'nu',
|
||||
'country_code',
|
||||
'type_id',
|
||||
'description',
|
||||
'person_id',
|
||||
'user_id'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'user_id',
|
||||
'person_id',
|
||||
'deleted'
|
||||
];
|
||||
|
||||
protected static function booted(){
|
||||
static::creating(function (PersonPhone $personPhone) {
|
||||
if(!isset($personPhone->user_id)){
|
||||
$personPhone->user_id = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function person(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Person\Person::class);
|
||||
|
||||
Reference in New Issue
Block a user