當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Product::getAbsentsList方法代碼示例

本文整理匯總了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']);
     }
 }
開發者ID:enotsokolov,項目名稱:vp_plus,代碼行數:53,代碼來源:AbsentController.php

示例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']);
         }
開發者ID:enotsokolov,項目名稱:vp_plus,代碼行數:67,代碼來源:ProductController.php


注:本文中的app\models\Product::getAbsentsList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。