Blame view

common/models/Subscribe.php 574 Bytes
d8c1a2e0   Yarik   Big commit artbox
1
2
3
4
  <?php
  
  namespace common\models;
  
b569ac34   Eugeny Galkovskiy   MESSAGES !!!! EVGEN!
5
6
  use Yii;
  
d8c1a2e0   Yarik   Big commit artbox
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  class Subscribe extends \yii\db\ActiveRecord
  {
      public static function tableName()
      {
          return 'subscribe';
      }
      
      public function rules()
      {
          return [
              [['email','sale'], 'required'],
              [['email'], 'email'],
              [['email'], 'is_email'],
          ];
      }
      
      public function is_email($attribute){
  		if(self::find()
  			->where('email = :email', [':email' => $this->email])
  			->exists())
b569ac34   Eugeny Galkovskiy   MESSAGES !!!! EVGEN!
27
              $this->addError('email', Yii::t('app', 'emailis'));
d8c1a2e0   Yarik   Big commit artbox
28
29
30
      }
      
  }