public function update(ProfileRequest $request) { $values = []; foreach ($request->rules() as $field => $rules) { $values[$field] = $request->input($field); } Profile::loginProfile()->update($values); flash()->info('The profile has been updated'); return redirect(route('home')); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(PasswordRequest $request) { $user = Profile::loginProfile()->user; if (Hash::check($request->input('old_password'), $user->password)) { // The passwords match... $user->password = bcrypt($request->input('password')); $user->save(); Flash::info('Password Updated'); return redirect(route('home')); } $errors = []; $errors['old_password'] = '******'; return $request->response($errors); }
public static function link_to_sorting($route, $view, $col, $title = null, $attributes = []) { if (is_null($title)) { $title = str_replace('_', ' ', $col); $title = ucfirst($title); } $order_by = Profile::loginProfile()->getOrderBy($view); if (!is_array($order_by)) { $order_by = []; } $indicator = array_has($order_by, $col) ? $order_by[$col] === 'asc' ? '↓' : '↑' : null; $parameters = [$col, Profile::loginProfile()->getOrderByValue($view, $col) === 'asc' ? 'desc' : 'asc']; return link_to_route($route, "{$title}{$indicator}", $parameters, $attributes); }
public function getFilter() { $values = []; foreach ($this->filter_fields as $field) { $values[$field] = Profile::loginProfile()->getFilterValue($this->index_view, $field); } return $values; }
/** * @return \Illuminate\View\View */ public function index() { $filter = $this->getFilter(); $models = $this->getModels($filter)->with('owner'); $models = $models->paginate(Profile::loginProfile()->per_page); return view($this->index_view, compact('models', 'filter')); }
public static function FilterByLabel($view) { $filters = Profile::loginProfile()->getFilters($view); $values = []; foreach ($filters as $key => $value) { if (trim($value) != '') { $values[] = "{$key}: {$value}"; } } return implode(' | ', $values); }