public function db(Request $request)
 {
     if ($request->ajax()) {
         $requests = new AjaxTable($request);
         $requests->select('inventory_transactions', array('id', 'state', 'original_quantity', 'updated_at'));
         $requests->with('inventory_stocks', array('inventory_id', 'user_id'), 'id', 'inventory_transactions', 'stock_id');
         $requests->with('users', array('name'), 'id', 'inventory_stocks', 'user_id');
         $requests->with('inventories', array('name', 'serialnr'), 'id', 'inventory_stocks', 'inventory_id');
         //$requests->with('inventory_transaction_histories', array('quantity_before'), 'id', 'inventory_stocks', 'inventory_id');
         //$requests->with('users', array('name'), 'user', 'user_id');
         return $requests->get();
     } else {
         return null;
     }
 }
 /**
  * Fetch all tools from database
  *
  * @param Request          $request (Ajax)
  *
  * @return array
  */
 public function db(Request $request)
 {
     if ($request->ajax()) {
         $tools = new AjaxTable($request);
         $tools->select('inventories', array('id', 'serialnr'));
         $tools->with('categories', array('id', 'name'), 'id', 'inventories', 'category_id');
         $tools->with('inventory_suppliers', array('supplier_id'), 'inventory_id', 'inventories', 'id');
         $tools->with('suppliers', array('name'), 'id', 'inventory_suppliers', 'supplier_id');
         return $tools->get();
     } else {
     }
 }