| 123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Models;
- // 关键:导入正确的 Builder 类(Eloquent 构建器)
- use Illuminate\Database\Eloquent\Builder;
- class Operation extends BaseModel
- {
-
- protected $fillable = ['date', 'recharge', 'withdraw', 'balance_difference', 'total_price', 'user_total_money'];
-
-
- public function newQuery($excludeDeleted = true): Builder
- {
- // 1. 获取原生 Eloquent 查询构建器
- $query = parent::newQuery($excludeDeleted);
-
- // 2. 强制清空当前连接的表前缀(从根源阻止拼接)
- $this->getConnection()->setTablePrefix('');
-
- // 3. 强制指定查询的表名为 la_operation(覆盖所有拼接逻辑)
- $query->from('bot_operation');
-
- return $query;
- }
- }
|