/** * Display the specified post. * * @param int $id * @return Response */ public function index($slug) { $post = Post::where('slug', '=', $slug)->first(); //Make sure post is active if (!Auth::guest() && Auth::user()->role == 'admin' || $post->active) { $author = User::find($post->user_id); $data = array('post' => $post, 'author' => $author, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all()); return View::make('Theme::post', $data); } else { return Redirect::to('posts')->with(array('note' => 'Sorry, this post is no longer active.', 'note_type' => 'error')); } }
public function update() { $input = Input::all(); $id = $input['id']; $user = User::find($id); if (Input::hasFile('avatar')) { $input['avatar'] = ImageHandler::uploadImage(Input::file('avatar'), 'avatars'); } else { $input['avatar'] = $user->avatar; } if (empty($input['active'])) { $input['active'] = 0; } if ($input['password'] == '') { $input['password'] = $user->password; } else { $input['password'] = Hash::make($input['password']); } $user->update($input); return Redirect::to('admin/user/edit/' . $id)->with(array('note' => 'Successfully Updated User Settings', 'note_type' => 'success')); }