|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
|
|
|
|
+use App\Http\Requests\DepartmentRequest;
|
|
use App\Model\Adminuser;
|
|
use App\Model\Adminuser;
|
|
use App\Model\Department;
|
|
use App\Model\Department;
|
|
use App\Model\Job;
|
|
use App\Model\Job;
|
|
@@ -39,10 +40,10 @@ class DepartmentController extends CommonController
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public function update($dep_id)
|
|
|
|
|
|
+ public function update(DepartmentRequest $request, $dep_id)
|
|
{
|
|
{
|
|
|
|
|
|
- if (!Department::where('id', $dep_id)->update(Input::except('_token', '_method'))) return back()->withErrors('机构信息更新失败,请稍后重试!');
|
|
|
|
|
|
+ if (!Department::where('id', $dep_id)->update($request->except('_token', '_method'))) return back()->withErrors('机构信息更新失败,请稍后重试!');
|
|
|
|
|
|
return redirect('/department');
|
|
return redirect('/department');
|
|
|
|
|
|
@@ -57,24 +58,13 @@ class DepartmentController extends CommonController
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public function store()
|
|
|
|
|
|
+ public function store(DepartmentRequest $request)
|
|
{
|
|
{
|
|
|
|
|
|
- $input = Input::except('_token');
|
|
|
|
|
|
+ $input = $request->except('_token');
|
|
|
|
|
|
$input['display'] = '1';
|
|
$input['display'] = '1';
|
|
|
|
|
|
- $validator = Validator::make($input, [
|
|
|
|
- 'department_description' => 'max:200',
|
|
|
|
- 'department_name' => 'required|max:100',
|
|
|
|
- ], [
|
|
|
|
- 'department_name.required' => '名称不能为空!',
|
|
|
|
- 'department_description.max' => '描述不能超过100字!',
|
|
|
|
- 'department_name.max' => '名称请保持在50字内!',
|
|
|
|
- ]);
|
|
|
|
-
|
|
|
|
- if ($validator->fails()) return back()->withErrors($validator);
|
|
|
|
-
|
|
|
|
if (!Department::create($input)) return back()->withErrors('新建失败,请稍后重试!');
|
|
if (!Department::create($input)) return back()->withErrors('新建失败,请稍后重试!');
|
|
|
|
|
|
return redirect('/department');
|
|
return redirect('/department');
|