AllwinStoreChain.php 684 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 门店管理
  7. */
  8. namespace app\allwin\model;
  9. use think\Model;
  10. class AllwinStoreChain extends Model{
  11. //主店铺
  12. public function store(){
  13. return $this->hasOne('AllwinStore','id','store_id');
  14. }
  15. /**
  16. * 置顶或取消
  17. * @param integer $id
  18. */
  19. public static function isType(int $id){
  20. $result = self::where(['id' => $id])->field('types')->find();
  21. $result->types = $result->types ? 0 : 1;
  22. return $result->save();
  23. }
  24. }