Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace backend\models;
- use Yii;
- use backend\models\Uslugi;
- /**
- * This is the model class for table "zayvki".
- *
- * @property int $id
- * @property int $user_id
- * @property int $status
- * @property int $master
- * @property int $uk
- * @property string $create_at
- * @property int $oplata_id
- * @property string $data_vyp
- *
- */
- class Zayvki extends \yii\db\ActiveRecord
- {
- public $uslugi_id;
- const STATUS_NEW = 1;
- const STATUS_WORK = 2;
- const STATUS_NONWORK = 3;
- const STATUS_FINISH = 4;
- public function getOrder(){
- return $this->hasOne(Order::className(), ['zayvki_id' => 'id']);
- }
- public function getUseruk(){
- return $this->hasOne(Users::className(), ['id' => 'uk']);
- }
- public function getUslugi(){
- return $this->hasOne(Uslugi::className(), ['id' => 'uslugi_id']);
- }
- public function getUser(){
- return $this->hasOne(Users::className(), ['id' => 'user_id']);
- }
- public static function statuses()
- {
- return [
- self::STATUS_NEW => 'Новая',
- self::STATUS_WORK => 'В работе',
- self::STATUS_NONWORK => 'Отклонена',
- self::STATUS_FINISH => 'Выполненая',
- ];
- }
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'zayvki';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['user_id'], 'required'],
- [['user_id', 'status', 'master', 'uk', 'oplata_id'], 'integer'],
- [['create_at'], 'safe'],
- [['status'], 'default', 'value' => 1],
- [['oplata_id'], 'default', 'value' => 1],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => '№ заявки',
- 'user_id' => 'Житель',
- 'status' => 'Статус',
- 'master' => 'Мастер',
- 'uk' => 'УК',
- 'create_at' => 'Дата заявки',
- 'oplata_id' => 'Способ оплаты',
- 'data_vyp' => 'Желаемое время',
- 'uslugi_id' => "Услуга"
- ];
- }
- public static function getDropDown(){
- return ArrayHelper::map(self::find()->all(),'id','usluginame');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement