コード例 #1
0
 public function testStore()
 {
     //TODO:
     $post_category = new Posts_category();
     $post_category->title = 'GGC Test Category!';
     $post_category->description = 'This is a fake data blah blah blah';
     $post_category->created_at = new DateTime();
     $post_category->updated_at = new DateTime();
     $post_category->save();
     Posts_category::findOrFail($post_category->id);
 }
コード例 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $category = Posts_category::findOrFail($id);
     /**		$validator = Validator::make($data = Input::all(), Posts_category::$rules);
     
     		if ($validator->fails())
     		{
     			return Redirect::back()->withErrors($validator)->withInput();
     		}
     **/
     $category->title = Input::get('title');
     $category->description = Input::get('description');
     $category->save();
     return Redirect::action('Posts_CategoryController@index');
 }