Beispiel #1
0
 /**
  * Mendapatkan Total Stock
  * @param $stockId
  *
  * @return mixed
  */
 public static function getTotalStockFromStockId($stockId)
 {
     if (static::isStockAlreadyExist($stockId)) {
         return Stockproducts::whereId($stockId)->pluck('total');
     }
     return false;
 }
Beispiel #2
0
         sleep(1);
         echo $sep;
         //					Generate Product, Detail , Stock, Stock History
         echo "Generate Product , detail , Stock,stock detail ...";
         echo \Emayk\Ics\Repo\Products\Products::generateSampleProducts();
         sleep(1);
         echo $sep;
         //					Generate Office
         echo "<br/> <hr>";
         sleep(1);
         echo "[ " . \Carbon\Carbon::create() . " ]" . "Finish....,Generate Done";
     });
 });
 Route::get('stockhistory', function () {
     $stockId = 1;
     $total = \Emayk\Ics\Repo\Stockproducts\Stockproducts::whereId($stockId)->pluck('total');
     return $total;
     $stock = \Emayk\Ics\Repo\Stockproducts\Stockproducts::find($stockId);
     $stock->total = 0;
     $stock->save();
     $stockHistories = \Emayk\Ics\Repo\Stockproducthistory\Stockproducthistory::whereStockId($stockId);
     if ($stockHistories->count()) {
         $ids = $stockHistories->lists('id');
         foreach ($ids as $shId) {
             \Emayk\Ics\Repo\Stockproducthistory\Stockproducthistory::destroy($shId);
         }
         /*Update Stock Id ke 0*/
         $stock = \Emayk\Ics\Repo\Stockproducts\Stockproducts::find($stockId);
         $stock->total = 0;
         $stock->save();
     }