Example #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postSave(Request $request)
 {
     $input = $request->all();
     $rules = array('mc' => 'required|unique:px_pfdj', 'zdfz' => 'numeric', 'zgfz' => 'numeric');
     $validator = Validator::make($input, $rules);
     if ($validator->passes()) {
         $pfdj = new Pfdj();
         $pfdj->mc = $input['mc'];
         $pfdj->zdfz = $input['zdfz'];
         $pfdj->zgfz = $input['zgfz'];
         if ($pfdj->save()) {
             return redirect('pfdj/list')->with('status', '评分等级 ' . $pfdj->mc . ' 添加成功');
         } else {
             return back()->withErrors('评分等级添加失败');
         }
     } else {
         return back()->withErrors($validator);
     }
 }