public function run() { DB::table('auction_items')->delete(); AuctionItem::truncate(); $AuctionItems = array(); $lexer = new Lexer(new LexerConfig()); $interpreter = new Interpreter(); $interpreter->addObserver(function (array $row) use(&$AuctionItems) { $ItemOne = Auctionitem::create(array('transactionDate' => $row[0], 'itemId' => $row[1], 'nameofActionItem' => $row[2], 'auctionDescription' => $row[3], 'auctionValue' => $row[4], 'auctionDonor' => $row[5], 'auctionLocation' => $row[6], 'auctionNotes' => $row[7])); $this->command->info("Added " . $row[1] . " item and."); }); $fileName = $this->getDir() . '/Auction Items.csv'; $lexer->parse($fileName, $interpreter); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $item = AuctionItem::find($id); $item->delete(); }