-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel Update break pagination #39977
Comments
|
|
I'm sorry but we don't support SqlServer 2008. Please upgrade to 2017 or preferable the latest one. |
I have the same problem and I can't upgrade to newer SqlServer, what is the solution to keep it working with the older SqlServer? |
@vedmant there is the solution, can't you read it? |
@PaolaRuby Can you point to to exact details of the solution? |
Here, above, there are not so many comments to make it so difficult to read it |
Ok, here is a solution if someone is searching: <?php
namespace App\Database;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\Grammars\SqlServerGrammar as QueryGrammar;
class SqlServerGrammar extends QueryGrammar
{
/**
* Compile a select query into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @return string
*/
public function compileSelect(Builder $query)
{
if (! $query->offset) {
return parent::compileSelect($query);
}
// If an offset is present on the query, we will need to wrap the query in
// a big "ANSI" offset syntax block. This is very nasty compared to the
// other database systems but is necessary for implementing features.
if (is_null($query->columns)) {
$query->columns = ['*'];
}
return $this->compileAnsiOffset(
$query, $this->compileComponents($query)
);
}
} In AppServiceProvider.php public function register()
{
Connection::resolverFor('sqlsrv', function ($connection, $database, $prefix, $config) {
return new SqlServerConnection($connection, $database, $prefix, $config);
});
} Add custom SqlServerConnection.php with override: protected function getDefaultQueryGrammar()
{
return $this->withTablePrefix(new SqlServerGrammar);
} |
Description:
The recent Laravel upate break my entire Laravel Nova pagination.
I know SQL Server 2008 is not officially supported, we are planniing upgrade it, BUT with this release, all pagination (and my) are completely broken. It add a great breaking change!. Please, revert it.
On all pagination, I have the error:
Related PR
#39863
Steps To Reproduce:
Use Laravel Nova, SqlServer 2008 and install the last Laravel Version. All pagination will be broken.
The text was updated successfully, but these errors were encountered: