| xqd
@@ -99,6 +99,25 @@ class StudentController extends Controller
|
|
|
return $this->showWarning('数据错误');
|
|
|
}
|
|
|
|
|
|
+ $validator = Validator::make($request->input('data'), [
|
|
|
+ 'phone' => 'required'
|
|
|
+ ], [
|
|
|
+ 'phone.required' => '手机必填'
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if($validator->fails()) {
|
|
|
+ return back()->withErrors($validator)->withInput();
|
|
|
+ }
|
|
|
+
|
|
|
+ $tmp = $this->model->where([
|
|
|
+ ['id', '<>', $request->input('id')],
|
|
|
+ ['phone', '=', $request->input('data')['phone']],
|
|
|
+ ])->first();
|
|
|
+ if(!empty($tmp)) {
|
|
|
+ $validator->errors()->add('phone', '手机已存在!');
|
|
|
+ return back()->withErrors($validator)->withInput();
|
|
|
+ }
|
|
|
+
|
|
|
$res = $this->model->where('id', $request->input('id'))->update($request->input('data'));
|
|
|
|
|
|
if(!$res) {
|