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