本文整理汇总了PHP中app\models\Product::getAbsentsList方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getAbsentsList方法的具体用法?PHP Product::getAbsentsList怎么用?PHP Product::getAbsentsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::getAbsentsList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, Absent $absentModel, Product $productModel)
{
if (!right('Alerts')) {
abort(404);
}
if (isset($_POST['save'])) {
//pr($_POST);
$currentAbsents = $absentModel->getAbsentsList();
foreach ($_POST['fields'] as $key => $element) {
//если стоит галка Выполенно
if (isset($element['done'])) {
//удаляем дату у товаров
$productModel->deleteAbsent($element['old_absent']);
//удаляем уведомление
$absentModel->deleteAbsent($element['old_absent']);
} else {
//если меняем дату уведомления
if ($element['new_absent'] != $element['old_absent']) {
//меняем дату у товаров
$productModel->changeAbsent($element['old_absent'], $element['new_absent']);
//если уведомление с такой датой уже есть
if ($currentAbsents->search($element['new_absent']) !== false) {
if (!empty($element['note'])) {
//меняем комментарий
$absentModel->updateAbsent($element['new_absent'], array('note' => $element['note']));
}
//удаляем старое уведомление
$absentModel->deleteAbsent($element['old_absent']);
} else {
//просто меняем дату и коммент
$absentModel->updateAbsent($element['old_absent'], array('absent' => $element['new_absent'], 'note' => $element['note']));
}
} else {
//если написан комментарий
if (!empty($element['note'])) {
//меняем комментарий
$absentModel->updateAbsent($element['new_absent'], array('note' => $element['note']));
}
}
}
}
$absents = $productModel->getAbsentsList();
$absentModel->addAbsentsList($absents);
Session::flash('message', GetMessages("SUCCESS_UPDATE"));
return redirect($_SERVER['HTTP_REFERER']);
}
}
示例2: store
//.........这里部分代码省略.........
}
}
//MK_price_currency
if ($element['MK_price_currency']['new'] != $element['MK_price_currency']['old']) {
$res[$element['id']]['MK.currency'] = $element['MK_price_currency']['new'];
if ($childs) {
foreach ($childs as $child) {
$res[$child['product_id']]['MK.currency'] = $res[$element['id']]['MK.currency'];
$res[$child['product_id']]['MK.to_export'] = 1;
}
}
}
//MK update
if (isset($res[$element['id']]['products.in_stock']) or isset($res[$element['id']]['MK.enabled']) or isset($res[$element['id']]['MK.yandex_enabled']) or isset($res[$element['id']]['MK.price']) or isset($res[$element['id']]['MK.currency'])) {
$res[$element['id']]['MK.to_export'] = 1;
$res[$element['id']]['MK.updated_at'] = date('Y-m-d H:i:s');
$res[$element['id']]['MK.user_id'] = Auth::User()->id;
$res[$element['id']]['products.updated_at'] = date('Y-m-d H:i:s');
$res[$element['id']]['products.user_id'] = Auth::User()->id;
}
}
//product update
if (isset($res[$element['id']]['products.status']) or isset($res[$element['id']]['products.name']) or isset($res[$element['id']]['products.article']) or isset($res[$element['id']]['products.in_stock']) or isset($res[$element['id']]['products.mrc']) or isset($res[$element['id']]['products.mrc_currency']) or isset($res[$element['id']]['products.mrc_relation']) or isset($res[$element['id']]['products.mrc_raise_relation']) or isset($res[$element['id']]['products.price']) or isset($res[$element['id']]['products.price_currency']) or isset($res[$element['id']]['products.price_relation']) or isset($res[$element['id']]['products.price_raise_relation']) or isset($res[$element['id']]['products.target_margin']) or isset($res[$element['id']]['products.common_price'])) {
$res[$element['id']]['products.updated_at'] = date('Y-m-d H:i:s');
$res[$element['id']]['products.user_id'] = Auth::User()->id;
}
}
}
if (count($res) > 0) {
$productModel->updatingListProducts($res);
$historyModel->saveHistory('update_products', $res);
if ($reViewAbsents) {
$absentModel = new Absent();
$absents = $productModel->getAbsentsList();
$absentModel->addAbsentsList($absents);
}
Session::flash('message', GetMessages("SUCCESS_DATA_PRODUCTS_UPDATE"));
return redirect($_SERVER['HTTP_REFERER']);
} else {
Session::flash('message', GetMessages("ERROR_NO_DATA_FOR_UPDATE"));
return redirect($_SERVER['HTTP_REFERER']);
}
}
if (isset($_POST['update_product'])) {
if (!right('EditProduct')) {
abort(404);
}
//pr($_POST);
$res = array();
//status
!isset($_POST['status']['new']) ? $_POST['status']['new'] = 0 : ($_POST['status']['new'] = 1);
if ($_POST['status']['new'] != $_POST['status']['old']) {
$res[$_POST['id']]['products.status'] = $_POST['status']['new'];
}
//name
if ($_POST['name']['new'] != $_POST['name']['old']) {
$res[$_POST['id']]['products.name'] = trim($_POST['name']['new']);
}
//article
if ($_POST['article']['new'] != $_POST['article']['old']) {
$res[$_POST['id']]['products.article'] = trim($_POST['article']['new']);
}
//ean
if ($_POST['ean']['new'] != $_POST['ean']['old']) {
$res[$_POST['id']]['products.ean'] = trim($_POST['ean']['new']);
}