Beispiel #1
0
 /**
  * Membuat Record Hpp dari Product
  * Jika Hpp Belum ada  secara massal.
  *
  */
 public function createMassalHppProduct()
 {
     $oproducts = new \Emayk\Ics\Repo\Factory\Product\Eloquent();
     $listIds = $oproducts->lists('id');
     foreach ($listIds as $id) {
         $product = $oproducts->findOrFail($id);
         $hpp = $product->hpp;
         if (is_null($hpp)) {
             $this->add($product, 0, 0);
         }
     }
 }
Beispiel #2
0
             \Log::info('im execute');
             $hpp = $product->getHpp()->create(['pricemin' => 0, 'price' => 0, 'product_id' => $product->id]);
         }
         //			else {
         //
         //					\Log::info('im execute Else', $hpp->toArray());
         //					$hpp->pricemin = rand(100, 200);
         //					$hpp->price    = rand(200, 500);
         //					$hpp->save();
         //					\Log::info('Setelah disave adalah', $hpp->toArray());
         //				}
     }
     return 'Done';
 });
 Route::get("addstock", function () {
     $oProducts = new \Emayk\Ics\Repo\Factory\Product\Eloquent();
     //::lists('id');
     $productIds = $oProducts->lists('id');
     $product = $oProducts->findOrFail(1);
     $product->load('stock');
     $trxnumber_simulasi = 'TRX' . time();
     if (is_null($product->stock)) {
         //			Buat Stock
         $stock = new \Emayk\Ics\Repo\Factory\Product\Stock\Eloquent();
         $stock->add($product, 0, 0, 1);
     }
     return $oProducts->findOrFail(1);
 });
 Route::get('/', function () {
     return 'Test Print';
 });