public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Erporderitem::create([]); } }
/** * Show the form for editing the specified payment. * * @param int $id * @return Response */ public function edit($id) { $payment = Payment::find($id); $erporders = Erporder::all(); $erporderitems = Erporderitem::all(); return View::make('payments.edit', compact('payment', 'erporders', 'erporderitems')); }
public function payments() { $payments = Payment::all(); $erporders = Erporder::all(); $erporderitems = Erporderitem::all(); $organization = Organization::find(1); $pdf = PDF::loadView('erpreports.paymentsReport', compact('payments', 'erporders', 'erporderitems', 'organization'))->setPaper('a4')->setOrientation('potrait'); return $pdf->stream('Payment List.pdf'); }
/** * Remove the specified erporderitem from storage. * * @param int $id * @return Response */ public function destroy($id) { Erporderitem::destroy($id); return Redirect::route('erporderitems.index'); }
$orderitems = Session::get('quotationitems'); $total = Input::all(); // $client = Client: :findorfail(array_get($erporder, 'client')); // print_r($total); $order = new Erporder(); $order->order_number = array_get($erporder, 'order_number'); $order->client()->associate(array_get($erporder, 'client')); $order->date = date('Y-m-d', strtotime(array_get($erporder, 'date'))); $order->status = 'new'; //$order->discount_amount = array_get($total, 'discount'); $order->type = 'quotations'; $order->save(); foreach ($orderitems as $item) { $itm = Item::findOrFail($item['itemid']); $ord = Erporder::findOrFail($order->id); $orderitem = new Erporderitem(); $orderitem->erporder()->associate($ord); $orderitem->item()->associate($itm); $orderitem->price = $item['price']; $orderitem->quantity = $item['quantity']; //s$orderitem->duration = $item['duration']; $orderitem->save(); } //Session::flush('orderitems'); //Session::flush('erporder'); return Redirect::to('quotationorders'); }); Route::get('erporders/cancel/{id}', function ($id) { $order = Erporder::findorfail($id); $order->status = 'cancelled'; $order->update();