2021-11-04 17:07:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by Reliese Model.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class NhInsurance
|
|
|
|
*
|
|
|
|
* @property int $id
|
2021-11-12 05:08:03 +00:00
|
|
|
* @property int $network_id
|
|
|
|
* @property int $user_id
|
2021-11-04 17:07:15 +00:00
|
|
|
* @property string $insured_id
|
2022-03-28 23:49:57 +00:00
|
|
|
* @property int $months_grid_id
|
2021-11-12 05:08:03 +00:00
|
|
|
* @property float $bonus_amount
|
|
|
|
* @property int $number_of_beneficiaries
|
|
|
|
* @property float $total_bonus_amount
|
2022-02-17 14:05:47 +00:00
|
|
|
* @property float $insurance_coverage_amount
|
2021-11-04 17:07:15 +00:00
|
|
|
* @property Carbon|null $start_at
|
|
|
|
* @property Carbon|null $end_at
|
|
|
|
* @property string $state
|
|
|
|
* @property Carbon $created_at
|
|
|
|
* @property Carbon $updated_at
|
|
|
|
*
|
|
|
|
* @package App\Models
|
|
|
|
*/
|
|
|
|
class NhInsurance extends Model
|
|
|
|
{
|
|
|
|
protected $table = 'nh_insurances';
|
|
|
|
|
|
|
|
protected $dates = [
|
|
|
|
'start_at',
|
|
|
|
'end_at'
|
|
|
|
];
|
|
|
|
|
|
|
|
protected $fillable = [
|
2021-11-12 05:08:03 +00:00
|
|
|
'network_id',
|
|
|
|
'user_id',
|
2021-11-04 17:07:15 +00:00
|
|
|
'insured_id',
|
2022-03-28 23:49:57 +00:00
|
|
|
'months_grid_id',
|
2021-11-12 05:08:03 +00:00
|
|
|
'total_bonus_amount',
|
2022-02-17 14:05:47 +00:00
|
|
|
'insurance_coverage_amount',
|
2021-11-12 05:08:03 +00:00
|
|
|
'number_of_beneficiaries',
|
|
|
|
'bonus_amount',
|
2021-11-04 17:07:15 +00:00
|
|
|
'start_at',
|
|
|
|
'end_at',
|
2021-11-09 08:30:31 +00:00
|
|
|
'state',
|
2022-03-29 19:20:43 +00:00
|
|
|
'deadlines',
|
|
|
|
'paid_deadlines',
|
|
|
|
'amount_per_split',
|
|
|
|
'amount_last_payment'
|
2021-11-04 17:07:15 +00:00
|
|
|
];
|
2021-11-09 08:30:31 +00:00
|
|
|
|
2021-11-12 05:08:03 +00:00
|
|
|
public function network()
|
2021-11-09 08:30:31 +00:00
|
|
|
{
|
2021-11-12 05:08:03 +00:00
|
|
|
return $this->belongsTo(Network::class, 'network_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
|
|
}
|
|
|
|
|
2022-03-28 23:49:57 +00:00
|
|
|
public function monthsGrid()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(NhMonthsPricesGrid::class, 'months_grid_id');
|
|
|
|
}
|
|
|
|
|
2021-11-12 05:08:03 +00:00
|
|
|
public function beneficiaries()
|
|
|
|
{
|
2021-11-12 06:11:42 +00:00
|
|
|
return $this->hasManyThrough(NhHavingRight::class, NhInsurancesHavingRight::class,
|
|
|
|
'insurance_id', 'id', 'id', 'having_right_id');
|
2021-11-12 05:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function nhNetworkConfig()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(NhNetworksConfig::class, 'network_id', 'network_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function payment()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(NhInsurancesPayment::class, 'id', 'insurance_id');
|
2021-11-09 08:30:31 +00:00
|
|
|
}
|
2022-03-29 19:20:43 +00:00
|
|
|
|
|
|
|
public function invoices()
|
|
|
|
{
|
|
|
|
return $this->hasMany(NhInsurancesInvoice::class, 'id');
|
|
|
|
}
|
|
|
|
|
2021-11-04 17:07:15 +00:00
|
|
|
}
|