本文整理汇总了PHP中app\models\Product::deleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::deleteAll方法的具体用法?PHP Product::deleteAll怎么用?PHP Product::deleteAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::deleteAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeDelete
public function beforeDelete()
{
if (parent::beforeDelete()) {
Product::deleteAll(['cate_id' => $this->id]);
return true;
} else {
return false;
}
}
示例2: actionProductnamedelete
public function actionProductnamedelete()
{
$data = json_decode(file_get_contents("php://input"));
$userd = Product::deleteAll('sn=' . $data->id);
$arr = array('msg' => "Product Name deleted Successfully !!!", 'error' => '');
$jsn = json_encode($arr);
print_r($jsn);
}
示例3: actionDeleteall
public function actionDeleteall()
{
$role = UserRoleDetector::getUserRole();
Yii::$app->response->format = Response::FORMAT_JSON;
if ($role != 3 && $role != 4) {
echo json_encode(array('status' => 0, 'error_code' => Codes::$UNAUTHORIZED, 'errors' => StatusCodeMessage::$UNAUTHORIZED), JSON_PRETTY_PRINT);
} else {
$ids = json_decode($_REQUEST['ids']);
$stringIds = implode(",", $ids);
$connection = \Yii::$app->db;
if (Product::deleteAll('warehouse_id IN (' . $stringIds . ')')) {
echo json_encode(array('status' => 1, 'code' => 200, 'data' => 'deleted'), JSON_PRETTY_PRINT);
} else {
echo json_encode(array('status' => 0, 'error_code' => Codes::$BAD_REQUEST), JSON_PRETTY_PRINT);
}
}
}