/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $post = Posts::findOrFail($id); if (empty($post)) { return Response::view('errors.404', array(), 404); } return View::make('/post/edit', array('post' => $post)); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $post = Posts::findOrFail($id); $validator = Validator::make($data = Input::all(), Posts::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $post->update($data); return Redirect::route('posts.index'); }
public function testStore() { $post = new Posts(); $post->id = 123; $post->title = 'GGC Test Post!'; $post->temp_username = '******'; $post->message = 'This is a fake data blah blah blah'; $post->topic_id = 1651; $post->save(); Posts::findOrFail($post->id); }