anggagewor

Untitled

Feb 1st, 2022
2,439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.36 KB | None | 0 0
  1. <?php
  2.  
  3. namespace app\models;
  4.  
  5. use Yii;
  6.  
  7. /**
  8.  * This is the model class for table "clients".
  9.  *
  10.  * @property int $id
  11.  * @property string $name
  12.  * @property string $email
  13.  * @property string $address
  14.  * @property string $profession
  15.  * @property string $created_date
  16.  * @property string $updated_date
  17.  */
  18. class Clients extends \yii\db\ActiveRecord
  19. {
  20.     /**
  21.      * {@inheritdoc}
  22.      */
  23.     public static function tableName()
  24.     {
  25.         return 'clients';
  26.     }
  27.  
  28.     /**
  29.      * {@inheritdoc}
  30.      */
  31.     public function rules()
  32.     {
  33.         return [
  34.             [['name', 'email', 'address', 'profession', 'created_date', 'updated_date'], 'required'],
  35.             [['address'], 'string'],
  36.             [['created_date', 'updated_date'], 'safe'],
  37.             [['name', 'email', 'profession'], 'string', 'max' => 255],
  38.         ];
  39.     }
  40.  
  41.     /**
  42.      * {@inheritdoc}
  43.      */
  44.     public function attributeLabels()
  45.     {
  46.         return [
  47.             'id' => 'ID',
  48.             'name' => 'Name',
  49.             'email' => 'Email',
  50.             'address' => 'Address',
  51.             'profession' => 'Profession',
  52.             'created_date' => 'Created Date',
  53.             'updated_date' => 'Updated Date',
  54.         ];
  55.     }
  56.  
  57.     public function getTransactions()
  58.     {
  59.         return $this->hasMany(Transactions::class, ['client_id'=> 'id']);
  60.     }
  61. }
  62.  
Advertisement
Add Comment
Please, Sign In to add comment