mardi 28 juillet 2020

use whereIntegerInRaw In laravel5.5

I need to use whereIntegerInRaw query because when I have too large database, use whereIn is very slow.

I try to extend query builder and add that method to it,but it still no working.

In OptimizeBuilder

public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false)

$type = $not ? 'NotInRaw' : 'InRaw';

if ($values instanceof Arrayable) {
    $values = $values->toArray();
}

foreach ($values as &$value) {
    $value = (int) $value;
}

$this->wheres[] = compact('type', 'column', 'values', 'boolean');

return $this;

In model

public static function query(): OptimizeBuilder
{
  return parent::query();
}
public function newEloquentBuilder($query)
{
   return new OptimizeBuilder($query);
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/39NiJsl
via IFTTT

Aucun commentaire:

Enregistrer un commentaire