Thursday, 29 December 2016

yii2 LIKE Condition in query

$model = User::find()
->where(['LIKE', 'username', 'admin'])
->all();
//OR

$model = User::find()->where('username LIKE :query')->addParams([':query'=>'%admin%'])
->all();


$model = User::find()->where(['NOT LIKE', 'username', 'admin'])->all();


yii2 LIKE Condition  in query

No comments:

Post a Comment