FundTransferModel.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace App\Module\Fund\Models;
  3. use UCore\ModelCore;
  4. use App\Module\User\Models\User;
  5. /**
  6. * App\Module\Fund\Models\FundTransferModel
  7. *
  8. * field start
  9. * @property int $id 自增
  10. * @property int $user_id 用户id
  11. * @property int $to_user_id 转给用户id
  12. * @property string $remark 备注
  13. * @property int $amount 钱数
  14. * @property int $fund_id 来源账户的资金id
  15. * field end
  16. */
  17. class FundTransferModel extends ModelCore
  18. {
  19. protected $table = 'fund_transfer';
  20. // attrlist start
  21. protected $fillable = [
  22. 'id',
  23. 'user_id',
  24. 'to_user_id',
  25. 'remark',
  26. 'amount',
  27. 'fund_id',
  28. ];
  29. // attrlist end
  30. public $timestamps = false;
  31. /**
  32. * 获取用户信息
  33. */
  34. public function user()
  35. {
  36. return $this->belongsTo(User::class, 'id');
  37. }
  38. /**
  39. * 获取来源资金账户
  40. */
  41. public function fromFund()
  42. {
  43. return $this->belongsTo('App\Module\Fund\Models\FundModel', 'from_fund_id');
  44. }
  45. /**
  46. * 获取目标资金账户
  47. */
  48. public function toFund()
  49. {
  50. return $this->belongsTo('App\Module\Fund\Models\FundModel', 'to_fund_id');
  51. }
  52. }