예제 #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create($username)
 {
     if (credentialsMatch($username)) {
         $categories = Category::lists('id', 'name');
         return View::make('partials/_form', compact('categories'));
     }
     return Redirect::route('login');
 }
예제 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($username, $id)
 {
     if (credentialsMatch($username)) {
         $post = $this->postRepository->find($id, $username);
         try {
             $this->postCreator->update($post, Input::all());
         } catch (PostValidationException $e) {
             return Redirect::back()->withInput()->withErrors($e->getErrors());
         }
     }
     return Redirect::home();
 }