コード例 #1
0
 public function postCreate()
 {
     $validator = Validator::make(Input::all(), Category::$rules);
     if ($validator->passes()) {
         $category = new Category();
         $category->name = Input::get('name');
         $category->save();
         return Redirect::to('admin/categories/index')->with('message', 'Category Created');
     }
     return Redirect::to('admin/categories/index')->with('message', 'Something went wrong')->withErrors($validator)->withInput();
 }