/** * Run the database seeds. * * @return void */ public function run() { $dataname = ['meatlover', 'veggie', 'original', 'sweetlover']; $dataflavor = ['meat', 'vegetables', 'sugar', 'syrup']; $datasize = ['small', 'medium', 'large', 'large']; $datadescription = ['Delicious organic beef treats', 'Delicious carrots and beans treats', 'Delicious treats made of organic sugar', 'Delicious treats made of organic mapple syrup']; $dataprice = ['10.00', '7.00', '5.99', '4.99']; $dataquantity = ['1', '2', '3', '4']; for ($i = 0; $i < count($dataname); ++$i) { $treat = new \App\Treat(); $treat->name = $dataname[$i]; $treat->flavor = $dataflavor[$i]; $treat->size = $datasize[$i]; $treat->price = $dataprice[$i]; $treat->quantity = $dataquantity[$i]; $treat->order_total = $dataquantity[$i] * $dataprice[$i]; $treat->description = $datadescription[$i]; $treat->save(); } }
/** * Responds to requests to GET /books/create */ public function getCreate() { # Get all the possible accessories to display to the user $accesoryModel = new \App\Accesory(); $accesories_for_checkbox = $accesoryModel->getAccesoriesForCheckboxes(); $accesories_for_inputbox = $accesoryModel->getAccesoriesForInputboxes(); $accesoryprices_for_display = $accesoryModel->getAccesoriesPrices(); # Get all the possible treats to display to the user $treatModel = new \App\Treat(); $treats_for_checkbox = $treatModel->getTreatsForCheckboxes(); $treats_for_inputbox = $treatModel->getTreatsForInputboxes(); $treatprices_for_display = $treatModel->getTreatsPrices(); return view('orders.create')->with('treats_for_checkbox', $treats_for_checkbox)->with('treats_for_inputbox', $treats_for_inputbox)->with('accesories_for_checkbox', $accesories_for_checkbox)->with('accesories_for_inputbox', $accesories_for_inputbox)->with('accesoryprices_for_display', $accesoryprices_for_display)->with('treatprices_for_display', $treatprices_for_display); }