/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateJobSiteRequest $request)
 {
     //
     $site = \App\Models\Site::create($request->all());
     $site->save();
     return redirect('sites/' . $site->id)->with('message-success', 'Job site has been added.');
 }
Beispiel #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $data = $request->all();
     $validator = Validator::make($data, ['server_name' => 'between:1,50', 'server_ip' => 'ip']);
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     Site::create(['server_name' => $data['server_name'], 'server_ip' => $data['server_ip'], 'server_port' => $data['server_port'], 'server_type' => $data['server_type'], 'server_info' => $data['server_info'], 'server_config' => $data['server_config']]);
     $msg = array('msg' => '已成功更新');
     return json_encode($msg);
 }