Nessuna descrizione

CustomerDetails.php 945B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class CustomerDetails extends Model
  5. {
  6. protected $suffix = null;
  7. protected static $unguarded = true;
  8. protected $table;
  9. public $timestamps = false;
  10. const CHANGE_EXTERNAL_CONTACT_RDS = 'QyWechat::ChangeExternalContactList';
  11. /**
  12. * @return string
  13. * 获取对象表名
  14. */
  15. public function getTable()
  16. {
  17. return $this->table;
  18. }
  19. /**
  20. * @param $suffix
  21. * 设置对象表名
  22. */
  23. public function setSuffix($suffix)
  24. {
  25. $this->suffix = $suffix;
  26. if ($suffix !== null) {
  27. $this->table = 'dj_customer_details_' . $suffix;
  28. }
  29. }
  30. /**
  31. * @param $suffix
  32. * @return mixed
  33. * 设置表
  34. */
  35. public static function suffix($label)
  36. {
  37. $instance = new static;
  38. $instance->setSuffix($label);
  39. return $instance->newQuery();
  40. }
  41. }