| @@ 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()) { |
|
| @@ 108-111 (lines=4) @@ | ||
| 105 | $myQuery = clone $this->query; |
|
| 106 | // if its a normal query ( no union, having and distinct word ) |
|
| 107 | // replace the select with static text to improve performance |
|
| 108 | if (! Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 109 | $row_count = $this->wrap('row_count'); |
|
| 110 | $myQuery->select($this->connection->raw("'1' as {$row_count}")); |
|
| 111 | } |
|
| 112 | ||
| 113 | return $this->connection->table($this->connection->raw('(' . $myQuery->toSql() . ') count_row_table')) |
|
| 114 | ->setBindings($myQuery->getBindings())->count(); |
|