nicolaslopezj / searchable

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

SQLSTATE[42000]: Syntax error or access violation: 1055 #141

Closed michau85 closed 7 years ago

michau85 commented 7 years ago

Hello. I receive this error when I'm trying to perform basic search. I'm using Laravel 5.4

/// model namespace App;

use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; use Nicolaslopezj\Searchable\SearchableTrait;

class User extends Authenticatable { use SearchableTrait; use Notifiable;

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [
    'name', 'email', 'password',
];

/**
 * The attributes that should be hidden for arrays.
 *
 * @var array
 */
protected $hidden = [
    'password', 'remember_token',
];

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.name' => 10,

    ],

];

}

/// controller public function profile2() { $users= User::search('majk')->get(); return $users; }

Please help.

scripta55 commented 7 years ago

@michau85 in your config/database set under mysql => set 'strict' => false,

michau85 commented 7 years ago

It's working. Many thanks!

nhayder commented 5 years ago

:-0 its not recommended to turn strict mode to false, Its new Violation it self