| @@ 55-58 (lines=4) @@ | ||
| 52 | $myQuery = clone $this->query; |
|
| 53 | // if its a normal query ( no union, having and distinct word ) |
|
| 54 | // replace the select with static text to improve performance |
|
| 55 | if (!Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 56 | $row_count = $this->wrap('row_count'); |
|
| 57 | $myQuery->select($this->connection->raw("'1' as {$row_count}")); |
|
| 58 | } |
|
| 59 | ||
| 60 | // check for select soft deleted records |
|
| 61 | if (!$this->withTrashed && !$this->onlyTrashed && $this->modelUseSoftDeletes()) { |
|
| @@ 445-448 (lines=4) @@ | ||
| 442 | $myQuery = clone $this->query; |
|
| 443 | // if its a normal query ( no union, having and distinct word ) |
|
| 444 | // replace the select with static text to improve performance |
|
| 445 | if (!Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 446 | $row_count = $this->wrap('row_count'); |
|
| 447 | $myQuery->select($this->connection->raw("'1' as {$row_count}")); |
|
| 448 | } |
|
| 449 | ||
| 450 | return $this->connection->table($this->connection->raw('(' . $myQuery->toSql() . ') count_row_table')) |
|
| 451 | ->setBindings($myQuery->getBindings())->count(); |
|