Pivot.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. namespace think\model;
  12. use think\Model;
  13. class Pivot extends Model
  14. {
  15. /** @var Model */
  16. public $parent;
  17. protected $autoWriteTimestamp = false;
  18. /**
  19. * 架构函数
  20. * @access public
  21. * @param array|object $data 数据
  22. * @param Model $parent 上级模型
  23. * @param string $table 中间数据表名
  24. */
  25. public function __construct($data = [], Model $parent = null, $table = '')
  26. {
  27. $this->parent = $parent;
  28. if (is_null($this->name)) {
  29. $this->name = $table;
  30. }
  31. parent::__construct($data);
  32. }
  33. }