| @@ 56-59 (lines=4) @@ | ||
| 53 | $myQuery = clone $this->query; |
|
| 54 | // if its a normal query ( no union, having and distinct word ) |
|
| 55 | // replace the select with static text to improve performance |
|
| 56 | if (! Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 57 | $row_count = $this->wrap('row_count'); |
|
| 58 | $myQuery->select($this->connection->raw("'1' as {$row_count}")); |
|
| 59 | } |
|
| 60 | ||
| 61 | // check for select soft deleted records |
|
| 62 | if (! $this->withTrashed && ! $this->onlyTrashed && $this->modelUseSoftDeletes()) { |
|
| @@ 102-105 (lines=4) @@ | ||
| 99 | $myQuery = clone $this->query; |
|
| 100 | // if its a normal query ( no union, having and distinct word ) |
|
| 101 | // replace the select with static text to improve performance |
|
| 102 | if (! Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 103 | $row_count = $this->wrap('row_count'); |
|
| 104 | $myQuery->select($this->connection->raw("'1' as {$row_count}")); |
|
| 105 | } |
|
| 106 | ||
| 107 | return $this->connection->table($this->connection->raw('(' . $myQuery->toSql() . ') count_row_table')) |
|
| 108 | ->setBindings($myQuery->getBindings())->count(); |
|