FundsRecord.php 803 B

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