/** * Display a listing of the resource. * * @return Response */ public function index() { $order = Order::count(); $supply = Supply::count(); $spares = Spares::count(); $car = Cars::count(); $data = array('order' => $order, 'supply' => $supply, 'spares' => $spares, 'car' => $car); if ($this->manager) { return View::make('dashbord.manager')->with($data); } else { if ($this->salesman) { return View::make('dashbord.salesman')->with($data); } else { return redirect('/login'); } } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $order = Order::find($id); $order_item = Item::where('order_id', $id)->select('item.quantity', 'spares.spar')->join('spares', 'item.spares_id', '=', 'spares.id')->get(); $data = array('order' => $order, 'order_item' => $order_item); return View::make('order.show')->with($data); }