fitness-web/frontend/models/ReceptionForm.php
2015-09-29 17:27:31 +02:00

49 lines
783 B
PHP

<?php
namespace frontend\models;
use Yii;
use yii\base\Model;
use common\models\Card;
use common\models\Customer;
/**
* ContactForm is the model behind the contact form.
*/
class ReceptionForm extends Model
{
public $number;
public $card;
public $customer;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['number'], 'required'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'verifyCode' => 'Verification Code',
];
}
public function readCard(){
$this->card = Card::findOne(['number' => $this->number]);
if ( $this->card != null ){
$this->customer = $this->card->customer;
}
}
}