/** * @param CreateStudentRequest $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(StudentRequest $request) { //$input=Request::all(); //$input['publichedAt']=Carbon::now(); $student = Student::create($request->all()); Session::flash('flash message', 'Task Successfully added'); // return redirect()->back(); return redirect('student'); }
public function store(StudentAdd $request) { $student = Student::create($request->all()); flash('Student Registered', $student->first_name . ' has been added.'); return back(); /*return redirect()->route('reports');*/ }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $this->authorize('edit', new Student()); //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input. Student::create($request->all()); return redirect('student'); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $students = array(['id_no' => '1', 'name' => 'muse cali', 'gender_type_id' => 1, 'tel' => '123-123-456', 'batch_id' => 1, 'enrollment_date' => date("Y-m-d"), 'date_of_birth' => date("Y-m-d"), 'guardians_id' => 1, 'user_id' => 1]); foreach ($students as $student) { Student::create($student); } }
public function run() { DB::table('students')->delete(); Student::create(['festember_id' => '1', 'card' => 'aXnfhFSsfds', 'name' => 'Rishi Rajasekaran', 'roll_no' => '106113078', 'facebook_id' => 'rajasekaran.rishi']); Student::create(['festember_id' => '2', 'card' => 'bFDDhfqFdxs', 'name' => 'Suyash Behera', 'roll_no' => '106113096', 'facebook_id' => 'sne9x']); Student::create(['festember_id' => '3', 'card' => '0013276499', 'name' => 'Siddarth Iyer', 'roll_no' => '106113089', 'facebook_id' => 'mindstormer619']); Student::create(['festember_id' => '4', 'card' => 'DjqpdfDjshf', 'name' => 'Desikan S', 'roll_no' => '106113093', 'facebook_id' => 'desikan93']); }
public function store(StudentRequest $request) { $input = $request->all(); $input['registered_at'] = time(); $student = Student::create($input); return redirect()->route('settings.student'); session()->flash('flash_message', 'You have been added 1 student!'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CreateStudentRequest $request) { $request['password'] = Hash::make(ucfirst(strtolower($request->last_name)) . substr($request->student_number, -3)); $request['student_group'] = "emphatic"; Student::create($request->all()); Auth::loginUsingId($request->student_number); $user = Auth::user(); return Redirect::to('pia/method/manual')->with("user", $user); }
public function store(StudentRequest $request) { $student = Student::create($request->all()); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($student); } flash()->success('salvato con successo!'); return redirect('students'); }
public function run() { //remember to run this from the VM... // DB::table('student')->delete(); $faker = Faker::create(); for ($i = 0; $i < 25; $i++) { Student::create(['name' => $faker->name(), 'created_at' => $faker->dateTime, 'updated_at' => $faker->dateTime]); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(StudentRequest $request) { $input = $request->all(); $student = Student::create(['name' => $input['name'], 'email' => $input['email'], 'telephone' => $input['telephone'], 'password' => bcrypt($input['password'])]); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($user); } flash()->success('Benvenuto Bello!'); return redirect('students'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(AddStudentRequest $request) { $id = $request->get('student_number'); $student = Student::where('student_number', $id)->first(); if (count($student) > 0) { return response()->json(['success' => false, 'message' => 'Student number already exist']); } $student = Student::create(['student_number' => $request->get('student_number'), 'fname' => $request->get('fname'), 'lname' => $request->get('lname'), 'address' => $request->get('address'), 'zip' => $request->get('zip'), 'city' => $request->get('city'), 'state' => $request->get('state'), 'phone' => $request->get('phone'), 'mobile' => $request->get('mobile'), 'email' => $request->get('email'), 'year' => $request->get('year'), 'section_id' => $request->get('section_id'), 'dob' => $request->get('dob')]); if (!$student->save()) { return response()->json(['success' => false, 'message' => 'Failed to save record']); } return response()->json(['success' => true, 'message' => 'New student saved successfully!']); }
/** * Store a newly created resource in storage. * * @param CreateStudentRequest $request * @return \Illuminate\Http\Response */ public function store(CreateStudentRequest $request) { $student = Student::create(['student' => ucwords($request->student), 'bday' => $request->bday, 'gender' => $request->gender, 'email' => $request->email]); $address = Address::create(['contact11' => $request->contact11]); $student->addresses()->save($address); foreach (Auth::user()->schools()->lists('school_id')->toArray() as $k => $v) { $value = $v; } $school = School::find($value); $grade = Grade::find($request->grade_id); $student->schools()->attach($school); $student->grades()->attach($grade); return redirect('principal/create#student-tab')->withInput(); }
/** * Run the users database seeds. * * @return void */ public function run() { //DB::table('users')->delete(); DB::table('students')->truncate(); //$data = ['type' => '本科', 'nationality' => '汤加', 'stu_id' => '60902064', 'name_cn' => '卡卡拉', 'name_en' => 'KAKALA VINNIE BARBARINO', 'passport_id' => 'R012751', 'sex' => '男', 'birthday' => '19821125', 'school' => '计算机与通信工程学院', 'major' => '电子信息工程', 'admission_date' => '20090901', 'old_class' => '信息0904', 'new_class' => '电信10', 'language' => '中文', 'fee' => '自费', 'address' => '海淀区北京科技大学留学生公寓X-418', 'telephone' => '13611308019', 'email' => '*****@*****.**', 'note2' => '2011年9月学汉语']; Student::create(['stu_id' => '41053017', 'stu_type' => '在校生', 'type' => '本科', 'nationality' => '汤加', 'name_cn' => '陈培远', 'name_en' => 'Gavin', 'passport_id' => 'R012751', 'gender' => '男', 'birthday' => '19821125', 'school' => '计算机与通信工程学院', 'major' => '电子信息工程', 'admission_date' => '20090901', 'old_class' => '信息0904', 'new_class' => '电信10', 'language' => '中文', 'fee_type' => '自费', 'inschool_address' => '海淀区北京科技大学留学生公寓X-418', 'telephone' => '13611308019', 'email' => '*****@*****.**']); Student::create(['stu_id' => 's20140023', 'stu_type' => '新生', 'type' => '硕士', 'nationality' => '中国', 'name_cn' => '陈培远']); Student::create(['stu_id' => 'b20140326', 'stu_type' => '休学', 'type' => '博士', 'nationality' => '中国', 'name_cn' => '啥玩意1']); Student::create(['stu_id' => 'b20140327', 'stu_type' => '毕业结业', 'type' => '博士', 'nationality' => '中国', 'name_cn' => '啥玩意2']); Student::create(['stu_id' => 'b20140328', 'stu_type' => '退学转学', 'type' => '博士', 'nationality' => '中国', 'name_cn' => '啥玩意3']); Student::create(['stu_id' => 'b20140329', 'stu_type' => '未报到', 'type' => '博士', 'nationality' => '中国', 'name_cn' => '啥玩意4']); Student::create(['stu_id' => 'b20140320', 'stu_type' => '休学', 'type' => '博士', 'nationality' => '中国', 'name_cn' => '啥玩意5']); // $data['csc_no'] = null; // $data['passport_id'] = null; // for($i = 0; $i < 500; $i++) // { // $data['stu_id']++; // $data['nationality'] = $i % 10; // Student::create($data); // } }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $this->authorize('create', new Inscription()); //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input. $schoolyear = Schoolyear::orderBy('id', 'DESC')->first(); $request['school_id'] = Auth::user()->school_id; $request['schoolyear_id'] = $schoolyear->id; //student first $student = null; if (!isset($request['student_id']) || $request['student_id'] == 0) { $student = Student::create($request->all()); } else { $student = Student::findOrFail($request['student_id']); $student->update($request->all()); } $request['student_id'] = $student->id; $inscription = Inscription::create($request->all()); //agregar al grupo $inscription->group->students->push($student); //return redirect('inscription'); return view('inscription.step2', compact('inscription')); }
public function create(Request $request) { $validator = Student::validate(); if ($validator->fails()) { return redirect()->route('students.new')->withErrors($validator)->withInput(); } $student = Student::create(Input::all()); //mass assignment //Display Flash msg on successful addition if ($student !== false) { if (is_null($request->input("interests"))) { //do nothing } else { //if saving of student is successful and interests is not null sync interests $student->interests()->sync($request->input("interests")); } Session::flash('message', "New student '" . $student->name . "' added successfully. "); return redirect()->route('students.index'); } else { Session::flash('message', "Adding new student unsuccessful."); return redirect()->route('students.index'); } }
public static function rollbackLog($id, $user, $review_ip) { $review_at = date('Y-m-d H:i:s', time()); $update_arr = array('review_name' => $user->name, 'review_email' => $user->email, 'review_ip' => $review_ip, 'review_at' => $review_at, 'review' => true, 'status' => '审核未通过'); $manage_log = self::find($id); $before = json_decode($manage_log->before_info, true); $after = json_decode($manage_log->after_info, true); //Student if ($manage_log->type == "新增信息") { $student = Student::find($after['id']); if (!$student) { return "数据回滚失败:学号为" . $after['id'] . "的学生已不存在!"; } $student->delete(); } if ($manage_log->type == "修改信息") { $data = array(); foreach ($before as $key => $value) { if ($before[$key] != $after[$key]) { $data[$key] = $before[$key]; } } $student = Student::find($after['id']); if (!$student) { return "数据回滚失败:学号为" . $after['id'] . "的学生已不存在!"; } $student->update($data); } if ($manage_log->type == "删除信息") { $student = Student::find($before['id']); if ($student) { return "数据回滚失败:已存在学号为" . $before['id'] . "的学生!"; } Student::create($before); } $manage_log->update($update_arr); }
protected function create_student(array $data) { return Student::create(['stud_firstname' => $data['firstname'], 'stud_lastname' => $data['lastname'], 'stud_description' => $data['about'], 'stud_image' => $data['image'], 'user_id' => $data['user_id']]); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('students')->truncate(); Student::create(['first_name' => 'Gabino', 'last_name' => 'Ang', 'address' => 'taga davao', 'city' => 'Davao City', 'zip' => '9999', 'state_id' => 1, 'phone_number' => '123456789', 'mobile_number' => '987654321', 'email' => '*****@*****.**', 'year_level' => 4, 'section_id' => 2]); }
$verify = CaptchaVerify::verify($_POST["g-recaptcha-response"]); if (!$verify) { $error = ERROR_CAPTCHA; } else { $mail = new Message(); $mail->setFrom("C-SCAN'16 <{$mailer_username}>")->addTo($_POST['email'])->setSubject("C-SCAN'16 Registration"); $mailer = new Nette\Mail\SmtpMailer(array('host' => 'smtp.gmail.com', 'username' => $mailer_username, 'password' => $mailer_password, 'secure' => 'ssl')); $factory = new ValidatorFactory(new Translator('en')); $messages = array('required' => 'The :attribute field is required.', 'max' => 'Please enter a valid :attribute number.', 'min' => 'Please enter a valid :attribute field.', 'email' => 'Please enter a valid email address.', 'numberic' => 'The :attribute field should consist only of digits.', 'integer' => 'The :attribute field should be selected.', 'digits_between' => 'The :attribute field should be contain minimum of 10 digits.'); if ($_POST['type'] == "student") { $rules = array('college' => 'required|integer', 'faculty' => 'required', 'name' => 'required', 'email' => 'required|email', 'phone' => 'required|numeric|digits_between:10,15', 'course' => 'required', 'semester' => 'required', 'gender' => 'required', 'food' => 'required'); $validator = $factory->make($_POST, $rules, $messages); if ($validator->passes()) { $num = Student::where('college', $_POST['college'])->count(); $_POST['regid'] = $num + 1; if ($v = Student::create($_POST)) { $regid = $v->colg->abbr . "S" . str_pad($_POST['regid'], 3, '0', STR_PAD_LEFT); $name = $_POST['name']; $mail->setHTMLBody("Hi {$name},<br/>You have successfully registered for C-SCAN 2016. Your registration ID is " . $regid . ". The confirmation regarding the same will be done via email on or before 1st February.<br/>For more details and updates, please visit our <a href='http://www.cscan.org.in'>website</a>.<br/><br/>Thank you.<br/><br/>Yours Sincerely,<br/>Organising Team,<br/>C-SCAN 2016."); $mailer->send($mail); } else { $error = ERROR_DB; } } else { $error = ERROR_INVALID; } } else { if ($_POST['type'] == "faculty") { $rules = array('college' => 'required|integer', 'name' => 'required', 'email' => 'required|email', 'phone' => 'required|numeric|digits_between:10,15', 'designation' => 'required', 'interest' => 'required', 'gender' => 'required', 'food' => 'required'); $validator = $factory->make($_POST, $rules, $messages); if ($validator->passes()) {
/** * Create a new Student instance after a valid registration. * * @param array $data * @return Student */ protected function create(array $data) { // Create a Student instance $student = Student::create(['rollNo' => $data['rollNo'], 'dCode' => $data['dCode'], 'semNo' => $data['semNo'], 'registrationNo' => $data['registrationNo'], 'sectionId' => $data['sectionId'], 'name' => $data['name'], 'fatherName' => $data['fatherName'], 'motherName' => $data['motherName'], 'email' => $data['email'], 'phoneNo' => $data['phoneNo'], 'currentAddress' => $data['currentAddress'], 'permanentAddress' => $data['permanentAddress'], 'password' => bcrypt($data['password']), 'dob' => $data['dob'], 'verified' => false]); return $student; }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'address' => 'required', 'zip' => 'required|max:10', 'city' => 'required|max:50', 'phone_number' => 'required|max:20', 'mobile_number' => 'required|max:20', 'year_level' => 'required|max:2', 'email' => 'required|email|max:255']); Student::create(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'address' => $request->address, 'zip' => $request->zip, 'city' => $request->city, 'state_id' => $request->state_id, 'phone_number' => $request->phone_number, 'mobile_number' => $request->mobile_number, 'email' => $request->email, 'year_level' => $request->year_level, 'section_id' => $request->section_id]); return redirect('/student'); }
public function seed_students() { $students = array("Andrew Javier", "Ycea Sosa", "Denise Viernes", "Jazzlyn Pasco", "Nikeya Gregorio", "Brian Pineda"); foreach ($students as $student) { $name = explode(" ", $student); $data = array("first_name" => $name[0], "last_name" => $name[1], "password" => Hash::make('1234'), "student_number" => $name[1] . $name[0][0], "student_group" => "emphatic"); Student::create($data); } $students = array("Vandurke Jarque", "Zyrene DeLeon", "Patricia Lavadia", "Raven Fercol", "Cielo Segarra", "Jonalyn DeJesus", "Marlou Agner"); foreach ($students as $student) { $name = explode(" ", $student); $data = array("first_name" => $name[0], "last_name" => $name[1], "password" => Hash::make('1234'), "student_number" => $name[1] . $name[0][0], "student_group" => "non-emphatic"); Student::create($data); } }
public function getUpdateinfo(Request $request) { $arr = $request->all(); //把未赋值的参数赋为null while (list($key, $val) = each($arr)) { if ($val == "") { $arr[$key] = null; } } $arr['id'] = strtoupper($arr['id']); $arr['old_id'] = strtoupper($arr['old_id']); $arr['suspend_years'] = (int) $arr['suspend_years']; unset($arr['created_at']); unset($arr['updated_at']); if ($request->has("id")) { //如果存在old_stu_id,说明不是新添加信息 if ($request->has("old_id") && $arr["old_id"]) { //如果新旧stu_id相同,说明没有修改stu_id,则不用做stu_id重复测试 if ($arr["id"] == $arr["old_id"]) { $stu = Student::find($arr["id"]); if ($stu) { $before_json = $stu->toJson(); $operand = $stu->name_cn . "(" . $stu->id . ")"; $stu->update($arr); $after_json = $stu->toJson(); echo $after_json . "<br />"; echo $before_json; if ($after_json != $before_json) { StudentManageLog::insertLog("修改信息", $operand, $before_json, $after_json, $request->ip()); } $response = array('status' => ['error' => 0, 'note' => '修改成功'], 'influence' => 1); return json_encode($response); } else { //没有该stu_id的学生 $response = array('status' => ['error' => 1, 'note' => '没有找到该学生'], 'influence' => 0); return json_encode($response); } } else { //如果新旧stu_id不相同,需要做stu_id重复测试 $stu = Student::find($arr["id"]); if ($stu) { //已有重复stu_id $response = array('status' => ['error' => 2, 'note' => '已有重复的学号'], 'influence' => 0); return json_encode($response); } else { //没有有重复stu_id,则修改信息 $stu = Student::find($arr["old_id"]); $before_json = $stu->toJson(); $operand = $stu->name_cn . "(" . $stu->id . ")"; $stu->update($arr); $stu->id = $arr["id"]; $stu->save(); $after_json = $stu->toJson(); //StudentManageLog::insertLog("修改信息", $operand, $before_json, $after_json, $request->ip()); $response = array('status' => ['error' => 0, 'note' => '修改成功'], 'influence' => 1); return json_encode($response); } } } else { $stu = Student::find($arr["id"]); if ($stu) { //已有重复stu_id $response = array('status' => ['error' => 3, 'note' => '已有重复的学号'], 'influence' => 0); return json_encode($response); } else { $before_json = null; $stu = Student::create($arr); $stu->id = $arr["id"]; $stu->save(); $operand = $stu->name_cn . "(" . $stu->id . ")"; $stu->update($arr); $after_json = $stu->toJson(); StudentManageLog::insertLog("新增信息", $operand, $before_json, $after_json, $request->ip()); $response = array('status' => ['error' => 0, 'note' => '添加成功'], 'influence' => 1); return json_encode($response); } } } else { $response = array('status' => ['error' => -1, 'note' => '缺少参数id'], 'influence' => 0); return json_encode($response); } }
public function store(Request $request) { $this->validateRequest($request); $student = Student::create($request->all()); return $this->createSuccessResponse("The student with id {$student->id} has been created", 201); }
public function saveName(Request $request) { $fullname = $request->input('fullname'); $student = $this->student->create(['fullname' => $fullname]); return response()->json(['data' => ['id' => $student->id, 'fullname' => $fullname], 'status' => 1]); }
public function store(RegisterStudent $request) { Student::create($request->all()); }
public function postStore() { $last = Student::create(Input::all()); return $last->id; }
public function store(Request $request) { return Student::create($request->all()); }