Trade.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "trade_logs".
  6. *
  7. * @property integer $id
  8. * @property integer $auk_id
  9. * @property string $date
  10. * @property string $comment
  11. * @property integer $user_id
  12. */
  13. class Trade extends \yii\db\ActiveRecord
  14. {
  15. /**
  16. * @inheritdoc
  17. */
  18. public static function tableName()
  19. {
  20. return 'trade_logs';
  21. }
  22. /**
  23. * @inheritdoc
  24. */
  25. public function rules()
  26. {
  27. return [
  28. [['auk_id', 'user_id'], 'integer'],
  29. [['date'], 'safe'],
  30. [['comment'], 'string', 'max' => 255]
  31. ];
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function attributeLabels()
  37. {
  38. return [
  39. 'id' => Yii::t('app', 'ID'),
  40. 'auk_id' => Yii::t('app', 'Auk ID'),
  41. 'date' => Yii::t('app', 'Date'),
  42. 'comment' => Yii::t('app', 'Comment'),
  43. 'user_id' => Yii::t('app', 'User ID'),
  44. ];
  45. }
  46. public function fields()
  47. {
  48. return
  49. [
  50. 'id',
  51. 'auk_id',
  52. 'date',
  53. 'comment',
  54. 'user_id',
  55. ];
  56. }
  57. public function getUser(){
  58. return $this->hasOne(User::className(), ['id' => 'user_id']);
  59. }
  60. public function getAt_org(){
  61. return $this->user->at_org;
  62. }
  63. }