79 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
| <?php
 | |
| 
 | |
| /**
 | |
|  * Created by Reliese Model.
 | |
|  */
 | |
| 
 | |
| namespace App\Models;
 | |
| 
 | |
| use Carbon\Carbon;
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| 
 | |
| /**
 | |
|  * Class NhInsurance
 | |
|  *
 | |
|  * @property int $id
 | |
|  * @property int $network_id
 | |
|  * @property int $user_id
 | |
|  * @property string $insured_id
 | |
|  * @property int $number_of_months
 | |
|  * @property float $bonus_amount
 | |
|  * @property int $number_of_beneficiaries
 | |
|  * @property float $total_bonus_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 = [
 | |
|         'network_id',
 | |
|         'user_id',
 | |
|         'insured_id',
 | |
|         'number_of_months',
 | |
|         'total_bonus_amount',
 | |
|         'number_of_beneficiaries',
 | |
|         'bonus_amount',
 | |
|         'start_at',
 | |
|         'end_at',
 | |
|         'state',
 | |
|     ];
 | |
| 
 | |
|     public function network()
 | |
|     {
 | |
|         return $this->belongsTo(Network::class, 'network_id');
 | |
|     }
 | |
| 
 | |
|     public function user()
 | |
|     {
 | |
|         return $this->belongsTo(User::class, 'user_id');
 | |
|     }
 | |
| 
 | |
|     public function beneficiaries()
 | |
|     {
 | |
|         return $this->hasManyThrough(NhHavingRight::class, NhInsurancesHavingRight::class,
 | |
|             'insurance_id', 'id', 'id', 'having_right_id');
 | |
|     }
 | |
| 
 | |
|     public function nhNetworkConfig()
 | |
|     {
 | |
|         return $this->belongsTo(NhNetworksConfig::class, 'network_id', 'network_id');
 | |
|     }
 | |
| 
 | |
|     public function payment()
 | |
|     {
 | |
|         return $this->belongsTo(NhInsurancesPayment::class, 'id', 'insurance_id');
 | |
|     }
 | |
| }
 |