Open gregoriochiko opened 6 years ago
Having the same issue.
$users = User::search('fred', null, true, true)->first();
class User extends Authenticatable { use Notifiable, hasRoles, SearchableTrait;
protected $searchable = [
/**
* Columns and their priority in search results.
* Columns with higher values are more important.
* Columns with equal values have equal importance.
*
* @var array
*/
'columns' => [
'users.first_name' => 10,
'users.last_name' => 10,
'users.username' => 10,
'users.qualification' => 10,
'users.email' => 10
]
];
}
Temporary solution: set strict mode to false.
'mysql' => [
'driver' => 'mysql',
[...]
'strict' => false,
],
Is there a "structural" solution?
Same error here 😢
Temporary solution: set strict mode to false.
'mysql' => [ 'driver' => 'mysql', [...] 'strict' => false, ],
this fixed the problem, is it safe to use tho?
Anyone update about this error?
getting same error , using laravel 5.8
Temporary solution: set strict mode to false.
'mysql' => [ 'driver' => 'mysql', [...] 'strict' => false, ],
this fixed the problem, is it safe to use tho?
According to this post its ok to set strict mode te false with some conditions.
https://stackoverflow.com/questions/42104412/what-is-the-use-of-strict-in-laravel-config-database
It's not wise to disable the strict mode. Never trust yourself.
@gpressutto5: I guess you have a point. Maybe it's a little more secure to only allow grouping by one column like so:
'mysql' => [
...
....
'strict' => true,
'modes' => [
//'ONLY_FULL_GROUP_BY', // Disable this to allow grouping by one column
'STRICT_TRANS_TABLES',
'NO_ZERO_IN_DATE',
'NO_ZERO_DATE',
'ERROR_FOR_DIVISION_BY_ZERO',
'NO_AUTO_CREATE_USER',
'NO_ENGINE_SUBSTITUTION'
],
]
Source: https://stackoverflow.com/questions/40917189/laravel-syntax-error-or-access-violation-1055-error
I got error while I'm using this trait normally. Here's my model:
And here's my controller:
And this is how I call the controller from unit test:
But when I run
vendor/bin/phpunit tests/Unit
I get this error:I've tried to remove the column
name
from the$searchable
columns, but it still gives the exactly same error.