47 خطوط
1.0 KiB
PHP
47 خطوط
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Contact extends Model
|
|
{
|
|
protected $fillable = [
|
|
'lead_id', 'company_id', 'deal_id', 'name', 'first_name', 'last_name',
|
|
'role', 'job_title', 'email', 'preferred_channel', 'description', 'status',
|
|
'is_primary', 'primary_reason', 'created_by',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['is_primary' => 'boolean'];
|
|
}
|
|
|
|
public function lead(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Lead::class);
|
|
}
|
|
|
|
public function company(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Company::class);
|
|
}
|
|
|
|
public function deal(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Deal::class);
|
|
}
|
|
|
|
public function phones(): HasMany
|
|
{
|
|
return $this->hasMany(ContactPhone::class);
|
|
}
|
|
|
|
public function callLogs(): HasMany
|
|
{
|
|
return $this->hasMany(CallLog::class);
|
|
}
|
|
}
|