/** * Display a listing of the resource. * * @return Response */ public function index() { //List all items $items = Item::orderBy('name', 'ASC')->get(); // Barcode $barcode = Barcode::first(); //Load the view and pass the items return view('inventory.item.index')->with('items', $items)->with('barcode', $barcode); }
/** * Delete some items * This broke my tests, because I then had children existing * whose parents were deleted, so when I tried to update the child, * it errored saying that parent didn't exist. */ private function deleteSomeItems() { $items = Item::orderBy('id', 'desc')->limit(4)->get(); foreach ($items as $item) { $item->delete(); } }