Store.php 604 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\common\models;
  3. /**
  4. * Created by PhpStorm.
  5. * Author: 芸众商城 www.yunzshop.com
  6. * Date: 2017/2/27
  7. * Time: 上午9:11
  8. */
  9. class Store extends BaseModel
  10. {
  11. public $table = 'yz_store';
  12. public function hasOneMember()
  13. {
  14. return $this->hasOne(Member::class, 'uid', 'uid');
  15. }
  16. /**
  17. * @param $keyword
  18. * @return mixed
  19. */
  20. public static function getStoreByName($keyword)
  21. {
  22. return static::uniacid()->select('id', 'store_name', 'thumb')
  23. ->where('store_name', 'like', '%' . $keyword . '%')
  24. ->get();
  25. }
  26. }