| @@ 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()) { |
|
| @@ 96-99 (lines=4) @@ | ||
| 93 | $myQuery = clone $this->query; |
|
| 94 | // if its a normal query ( no union, having and distinct word ) |
|
| 95 | // replace the select with static text to improve performance |
|
| 96 | if (!Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 97 | $row_count = $this->wrap('row_count'); |
|
| 98 | $myQuery->select($this->connection->raw("'1' as {$row_count}")); |
|
| 99 | } |
|
| 100 | ||
| 101 | return $this->connection->table($this->connection->raw('(' . $myQuery->toSql() . ') count_row_table')) |
|
| 102 | ->setBindings($myQuery->getBindings())->count(); |
|