You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.6 KiB
111 lines
3.6 KiB
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
//use yii\db\ActiveRecord;
|
|
|
|
/**
|
|
* This is the model class for table "non_auto_insurance".
|
|
*
|
|
* @property integer $id
|
|
* @property integer $scheme_id
|
|
* @property string $insurer_date_start
|
|
* @property string $insurer_date_end
|
|
* @property integer $seat
|
|
* @property integer $num
|
|
* @property string $insurant_name
|
|
* @property string $policy_holder_name
|
|
* @property string $beneficiary_name
|
|
* @property string $insurant_number
|
|
* @property string $policy_holder_number
|
|
* @property string $beneficiary_number
|
|
* @property string $insurant_phone
|
|
* @property string $policy_holder_phone
|
|
* @property string $beneficiary_phone
|
|
* @property string $company
|
|
* @property string $car_no
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
*/
|
|
class NonAutoInsurance extends \common\models\Base
|
|
{
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'non_auto_insurance';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['insurant_name', 'policy_holder_name', 'beneficiary_name', 'insurant_number', 'policy_holder_number', 'beneficiary_number', 'insurant_phone', 'policy_holder_phone', 'beneficiary_phone'], 'required'],
|
|
[['scheme_id', 'seat', 'num'], 'integer'],
|
|
[['insurer_date_start', 'insurer_date_end', 'created_at', 'updated_at'], 'safe'],
|
|
[['insurant_name', 'policy_holder_name', 'beneficiary_name', 'insurant_number', 'policy_holder_number', 'beneficiary_number', 'company', 'car_no'], 'string', 'max' => 50],
|
|
[['insurant_phone', 'policy_holder_phone', 'beneficiary_phone','insurant_phone1', 'policy_holder_phone1', 'beneficiary_phone1'], 'string', 'max' => 20],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'scheme_id' => 'Scheme ID',
|
|
'insurer_date_start' => 'Insurer Date Start',
|
|
'insurer_date_end' => 'Insurer Date End',
|
|
'seat' => 'Seat',
|
|
'num' => 'Num',
|
|
'insurant_name' => 'Insurant Name',
|
|
'policy_holder_name' => 'Policy Holder Name',
|
|
'beneficiary_name' => 'Beneficiary Name',
|
|
'insurant_number' => 'Insurant Number',
|
|
'policy_holder_number' => 'Policy Holder Number',
|
|
'beneficiary_number' => 'Beneficiary Number',
|
|
'insurant_phone' => 'Insurant Phone',
|
|
'policy_holder_phone' => 'Policy Holder Phone',
|
|
'beneficiary_phone' => 'Beneficiary Phone',
|
|
'company' => 'Company',
|
|
'car_no' => 'Car No',
|
|
'created_at' => 'Created At',
|
|
'updated_at' => 'Updated At',
|
|
];
|
|
}
|
|
public function add($data)
|
|
{
|
|
// dd($data);
|
|
// $data['scheme_id']=(int)$data['scheme_id'];
|
|
// $data['num']=(int)$data['num'];
|
|
// $data['created_at']=date('Y-m-d H:i:s',time()) ;
|
|
// $data['updated_at']=date('Y-m-d H:i:s',time()) ;
|
|
// dd($this);
|
|
if ($this->load($data) && $this->save()) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public function getSche()
|
|
{
|
|
return $this->hasOne(Scheme::className(),['id'=>'scheme_id']);
|
|
}
|
|
public function getNonUser()
|
|
{
|
|
return $this->hasOne(UserT::className(),['id'=>'non_user_id']);
|
|
}
|
|
public function getOrders()
|
|
{
|
|
return $this->hasMany(OrderT::className(),['non_id'=>'id']);
|
|
}
|
|
public function getUser()
|
|
{
|
|
return $this->hasOne(UserT::className(),['id'=>'non_user_id']);
|
|
}
|
|
}
|
|
|