本文整理汇总了PHP中AbstractModel::search方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractModel::search方法的具体用法?PHP AbstractModel::search怎么用?PHP AbstractModel::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractModel
的用法示例。
在下文中一共展示了AbstractModel::search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSearch
/**
* created by Yosin
*/
public function actionSearch()
{
$request = new Request();
if ($request->searchGood != "") {
$minLength = 2;
$select = new SelectPDO();
$select->from("lot", ["lot.*", "user.email", "user.phone"])->join("bid", "id", "lot_id")->join("user", "user_id", "id");
$results = AbstractModel::search($select, ["title", "description"], $request->searchGood, $minLength, false, true);
} else {
$results = [];
}
if (!$results) {
$results = [];
}
$this->view->lastGoods = $results;
$this->view->render('search');
$this->view->display();
}
示例2: searchProductWithCategory
public function searchProductWithCategory($request, $category_id)
{
$minLength = 2;
$this->select->from("lot", ["lot.*", "user.first_name", "user.last_Name", "user.phone", "user.email", "category.name"])->where("`lot`.`category_id` = ?", array($category_id))->join("user", "user_id", "id")->join("category", "category_id", "id");
$result = AbstractModel::search($this->select, ['title', 'description'], $request->searchText, $minLength, false, true);
return $result;
}
示例3: searchProduct
/**
* search product
*
* @param $request
* @param $id
* @return array|bool
*/
public static function searchProduct($request, $id)
{
$minLength = 2;
$field = $request->field;
if ($field == "lot") {
$select = new SelectPDO();
$select->from($field, "*")->where("`user_id` = ?", [$id]);
$results = AbstractModel::search($select, ["title", "description"], $request->searchText, $minLength = 2, false, true);
} else {
if ($field == "bid") {
$select = new SelectPDO();
$select->from("lot", ["lot.*", "user.email", "user.phone"])->where("`bid`.`user_id` = ?", [$id])->join("bid", "id", "lot_id")->join("user", "user_id", "id");
$results = AbstractModel::search($select, ["title", "description"], $request->searchText, $minLength, false, true);
}
}
return $results;
}