123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class CustomerDetails extends Model
- {
- protected $suffix = null;
- protected static $unguarded = true;
- protected $table;
- public $timestamps = false;
- const CHANGE_EXTERNAL_CONTACT_RDS = 'QyWechat::ChangeExternalContactList';
- /**
- * @return string
- * 获取对象表名
- */
- public function getTable()
- {
- return $this->table;
- }
- /**
- * @param $suffix
- * 设置对象表名
- */
- public function setSuffix($suffix)
- {
- $this->suffix = $suffix;
- if ($suffix !== null) {
- $this->table = 'dj_customer_details_' . $suffix;
- }
- }
- /**
- * @param $suffix
- * @return mixed
- * 设置表
- */
- public static function suffix($label)
- {
- $instance = new static;
- $instance->setSuffix($label);
- return $instance->newQuery();
- }
- }
|