/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $groups = Sentry::getGroups(); $outlets = SalesOutlets::dropdownList(); $roles = ['' => 'Select Role'] + User::$roles; $user = User::with('groups')->find($id); return View::make('users.edit', compact('groups', 'outlets', 'roles', 'user')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $input = Input::all(); $outlets = SalesOutlets::dropdownList(); $sales = Sales::with('items', 'customer')->where(function ($query) use($input) { if (array_key_exists('from', $input) && strlen($input['from'])) { $query->where(DB::raw('DATE(created_at)'), '>=', date('Y-m-d', strtotime($input['from']))); } if (array_key_exists('to', $input) && strlen($input['to'])) { $query->where(DB::raw('DATE(created_at)'), '<=', date('Y-m-d', strtotime($input['to']))); } if ($this->user->outlet_id != 0) { $query->where('outlet_id', '=', $this->user->outlet_id); } else { if (array_key_exists('outlet', $input) && $input['outlet'] != '') { $query->where('outlet_id', '=', $input['outlet']); } } if (array_key_exists('status', $input) && $input['status'] != '') { $query->where('status', '=', $input['status']); } })->paginate(20); return View::make('sales.index', compact('sales', 'index', 'input', 'outlets')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $distribution = Distributions::find($id); $input = Input::all(); $products = Products::filter($input, 25); $types = Types::dropdownList(); $outlets = SalesOutlets::dropdownList(); return View::make('distributions.edit', compact('products', 'types', 'input', 'outlets')); }