HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/ghayatcom/ghayatcom-api/app/InsuranceDetail.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\InsuranceDetail
 *
 * @property mixed $policy_number
 * @property mixed $company_name
 * @property mixed $insurance_type
 * @property mixed $first_name
 * @property mixed $last_name
 * @property mixed $passport_number
 * @property mixed $country_code
 * @property mixed $mobile_number
 * @property mixed $email
 * @property mixed $post_code
 * @property mixed $address
 * @property mixed $beneficiary_name
 * @property mixed $iban
 * @property mixed $bic
 */
class InsuranceDetail extends Model
{
    use SoftDeletes;

    protected $fillable = ['id', 'user_id', 'insurance_company_id', 'policy_number', 'company_name', 'cover_from', 'cover_to', 'insurance_type', 'first_name', 'last_name', 'passport_number', 'dob', 'country_code', 'mobile_number', 'email', 'country_id', 'post_code', 'address', 'beneficiary_name', 'iban', 'bic', 'created_by', 'updated_by', 'deleted_by'];

    protected $hidden = ['created_by', 'updated_by', 'deleted_by', 'deleted_at', 'updated_at'];

    protected $appends = ['insurance_company'];

    public function insuranceGet():HasOne
    {
        return $this->hasOne(InsuranceCompany::class, 'id', 'insurance_company_id');
    }

    public function getInsuranceCompanyAttribute()
    {
        return $this->insuranceGet->name;
    }

    public function getCountryIdAttribute($value)
    {
        return Country::select('id', 'name', 'iso2', 'currency')->where('id', $value)->first();
    }
}