Package system sms
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Models\Person;
|
||||
|
||||
use Blade;
|
||||
use App\Enums\PersonPhoneType;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -13,6 +13,7 @@ class PersonPhone extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\Person/PersonPhoneFactory> */
|
||||
use HasFactory;
|
||||
|
||||
use Searchable;
|
||||
use SoftDeletes;
|
||||
|
||||
@@ -22,25 +23,28 @@ class PersonPhone extends Model
|
||||
'type_id',
|
||||
'description',
|
||||
'person_id',
|
||||
'user_id'
|
||||
'user_id',
|
||||
'validated',
|
||||
'phone_type',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'user_id',
|
||||
'person_id',
|
||||
'deleted'
|
||||
'deleted',
|
||||
];
|
||||
|
||||
public function toSearchableArray(): array
|
||||
{
|
||||
return [
|
||||
'nu' => $this->nu
|
||||
'nu' => $this->nu,
|
||||
];
|
||||
}
|
||||
|
||||
protected static function booted(){
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function (PersonPhone $personPhone) {
|
||||
if(!isset($personPhone->user_id)){
|
||||
if (! isset($personPhone->user_id)) {
|
||||
$personPhone->user_id = auth()->id();
|
||||
}
|
||||
});
|
||||
@@ -55,4 +59,12 @@ public function type(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Person\PhoneType::class, 'type_id');
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'validated' => 'boolean',
|
||||
'phone_type' => PersonPhoneType::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user