public function postStudent(StudentRequest $request)
 {
     $user = new User();
     $user->username = $request->txtten;
     $user->password = Hash::make($request->txtten);
     $user->name = $request->txtten;
     $user->save();
     $user_id = $user->id;
     $permission = Permission::where('slug', 'student')->get()->first();
     $permissionUser = new PermissionUser();
     $permissionUser->permission_id = $permission->id;
     $permissionUser->user_id = $user_id;
     $permissionUser->save();
     $student = new ThiSinh();
     $student->ten = $request->txtten;
     $student->gioitinh = $request->sltGt;
     $student->namsinh = $request->txtns;
     $student->quequan = $request->txtqq;
     $student->khuvuc = $request->txtkv;
     $student->user_id = $user_id;
     $student->save();
     $thisinh_id = $student->id;
     $point = new Diem();
     $point->sbd = $request->txtsbd;
     $point->mon1 = 0;
     $point->mon2 = 0;
     $point->mon3 = 0;
     $point->khoi = $request->txtkt;
     $point->thisinh_id = $thisinh_id;
     $point->save();
     return redirect()->route('cluster-staff.quan-ly-thong-tin-thi-sinh.listStudent')->with(['flash_level' => 'success', 'flash_message' => 'Success!!! Complete Add Student']);
 }
Exemple #2
0
 public function postTaoTaiKhoanQuanLyNhanVienCum(TaiKhoanQuanLyNhanVienCumRequest $request)
 {
     // thêm vào bảng users
     $user = new User();
     $user->username = $request->txtUsername;
     $user->name = $request->txtName;
     $user->password = Hash::make($request->txtPassword);
     $user->save();
     // thêm vào bảng permission_user
     $permission = Permission::where('slug', 'clusterstaffmanager')->get()->first();
     $permissionUser = new PermissionUser();
     $permissionUser->permission_id = $permission->id;
     $permissionUser->user_id = $user->id;
     $permissionUser->save();
     return redirect()->action('AdminController@getTaoTaiKhoanQuanLyNhanVienCum')->with(['flash_level' => 'success', 'flash_message' => 'Thêm tài khoản thành công!']);
 }
 public function postTaoTaiKhoanNhanVienTruong(TaiKhoanNhanVienTruongRequest $request)
 {
     // thêm vào bảng users
     $user = new User();
     $user->username = $request->txtUsername;
     $user->name = $request->txtName;
     $user->password = Hash::make($request->txtPassword);
     $user->save();
     // thêm vào bảng permission_user
     $permission = Permission::where('slug', 'universitystaff')->get()->first();
     $permissionUser = new PermissionUser();
     $permissionUser->permission_id = $permission->id;
     $permissionUser->user_id = $user->id;
     $permissionUser->save();
     // thêm trường
     $truong = new Truong();
     $truong->tentr = $request->txtUniversity;
     $truong->matr = $request->txtUniversityCode;
     $truong->nhanvienquanly_user_id = $user->id;
     $truong->save();
     return redirect()->action('ClusterStaffManagerController@getTaoTaiKhoanNhanVienTruong')->with(['flash_level' => 'success', 'flash_message' => 'Thêm tài khoản thành công!']);
 }