/**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     MutasiStokBahan::where('tanggal', $this->tanggal)->delete();
     $bahans = \App\Bahan::MutasiStok($this->tanggal);
     $inserts = [];
     foreach ($bahans as $bahan) {
         array_push($inserts, ['bahan_id' => $bahan['id'], 'before' => $bahan['before'], 'pembelian' => $bahan['pembelian'], 'penjualan' => $bahan['penjualan'], 'adjustment_increase' => $bahan['adjustment_increase'], 'adjustment_reduction' => $bahan['adjustment_reduction'], 'sisa' => $bahan['sisa'], 'tanggal' => $this->tanggal]);
     }
     MutasiStokBahan::insert($inserts);
 }
 protected function _stokBahan(Request $request)
 {
     $tanggal = $request->get('tanggal') ? $request->get('tanggal') : date('Y-m-d');
     $bahans = \App\MutasiStokBahan::where('tanggal', $tanggal)->with(['bahan'])->get();
     return ['tanggal' => Carbon::parse($tanggal), 'bahans' => $bahans];
 }