nanosanteservice/app/Models/NhInsurance.php

86 lines
1.8 KiB
PHP
Raw Normal View History

<?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
* @property string $insured_id
* @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
* @property float $insurance_coverage_amount
* @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',
'insured_id',
'months_grid_id',
2021-11-12 05:08:03 +00:00
'total_bonus_amount',
'insurance_coverage_amount',
2021-11-12 05:08:03 +00:00
'number_of_beneficiaries',
'bonus_amount',
'start_at',
'end_at',
'state',
];
2021-11-12 05:08:03 +00:00
public function network()
{
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');
}
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');
}
}