Operation.php 862 B

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