nicolaslopezj / searchable

A php trait to search laravel models
MIT License
2.01k stars 291 forks source link

Support for Laravel version 8 #224

Open ishan-biztech opened 4 years ago

komen205 commented 3 years ago

It's working for me in laravel 8. I just had to : In config/database.php, set mysql's 'strict' to false.

'mysql' => [
    ...
    'strict' => false,
   ...
],

Originally posted by @kevintresuelo in https://github.com/nicolaslopezj/searchable/issues/206#issuecomment-737838085

zaros-systems commented 3 years ago

An alternative is to update the config modes on the fly, this way you only disable the modes needed to run your query

config()->set('database.connections.mysql.modes', [
    // 'ONLY_FULL_GROUP_BY',
    'STRICT_TRANS_TABLES',
    'NO_ZERO_IN_DATE',
    'NO_ZERO_DATE',
    'ERROR_FOR_DIVISION_BY_ZERO',
    'NO_AUTO_CREATE_USER',
    'NO_ENGINE_SUBSTITUTION'
]);

And then enable all modes again afterwards:

config()->set('database.connections.mysql.modes', null);

However this feels like a temporary fix that should not be needed.

From https://github.com/nicolaslopezj/searchable/issues/206#issuecomment-787066436