/**
  * Captures the Inventory Stock models restored event
  * and cascades the restore to all of it's movements.
  *
  * @param InventoryStock $stock
  */
 public function restored(InventoryStock $stock)
 {
     $movements = $stock->movements()->onlyTrashed()->get();
     if (count($movements) > 0) {
         foreach ($movements as $movement) {
             $movement->restore();
         }
     }
 }
 /**
  * Returns a new table of all movements for the specified inventory stock.
  *
  * @param Inventory      $item
  * @param InventoryStock $stock
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function tableMovements(Inventory $item, InventoryStock $stock)
 {
     $movements = $stock->movements();
     return $this->table->of('inventory.stocks.movements', function (TableGrid $table) use($item, $movements) {
         $table->with($movements)->paginate($this->perPage);
         $table->pageName = 'stock-movements';
         $table->column('before');
         $table->column('after');
         $table->column('change');
         $table->column('cost');
         $table->column('reason');
         $table->column('Change By', function (Column $column) {
             return $column->value = function (InventoryStockMovement $movement) {
                 if ($movement->user instanceof User) {
                     return $movement->user->getRecipientName();
                 }
                 return HTML::create('em', 'Unknown');
             };
         });
         $table->column('Change On', 'created_at');
     });
 }