本文整理汇总了PHP中app\Student::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::save方法的具体用法?PHP Student::save怎么用?PHP Student::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Student
的用法示例。
在下文中一共展示了Student::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postStore
public function postStore(Request $request)
{
$inputs = $request->all();
$rules = ['phone' => 'required'];
$validator = Validator::make($inputs, $rules);
if ($validator->passes()) {
$profile = DB::connection('pgsql')->table('xs_zxs')->join('zd_xb', 'zd_xb.dm', '=', 'xs_zxs.xbdm')->join('zd_mz', 'zd_mz.dm', '=', 'xs_zxs.mzdm')->select('xh', 'xm', 'zd_xb.mc as xb', 'csny', 'zd_mz.mc as mz', 'sfzh', 'ksh', 'jg', 'zy')->where('xh', '=', Auth::user()->xh)->first();
$special = DB::connection('pgsql')->table('jx_zy')->where('zy', '=', $profile->zy)->first();
$student = new Student();
$student->c_xh = $profile->xh;
$student->c_xm = iconv('UTF-8', 'GBK', $profile->xm);
$student->c_xb = iconv('UTF-8', 'GBK', $profile->xb);
$student->c_csrq = $profile->csny;
$student->c_mz = iconv('UTF-8', 'GBK', $profile->mz);
$student->c_sfzh = $profile->sfzh;
$student->c_ksh = $profile->ksh;
$student->c_jg = iconv('UTF-8', 'GBK', $profile->jg);
$student->c_bz = iconv('UTF-8', 'GBK', $special->mc);
$student->c_lxdh = $inputs['phone'];
$student->c_zyh = $inputs['major'];
if ($student->save()) {
return back()->with('status', '双学位报名成功');
} else {
return back()->withErrors('双学位报名失败');
}
} else {
return back()->withErrors($validator);
}
}
示例2: saveFile
public function saveFile()
{
$csvFile = Input::file('file');
$file_handle = fopen($csvFile, 'r');
while (!feof($file_handle)) {
$line_of_text = fgetcsv($file_handle, 1024);
if ($line_of_text != null) {
$studentData[] = array('stud_idno' => $line_of_text[0], 'lastname' => $line_of_text[2], 'firstname' => $line_of_text[3], 'middlename' => $line_of_text[4], 'yr_sec' => $line_of_text[5], 'course' => $line_of_text[6], 'college' => $line_of_text[7]);
}
}
fclose($file_handle);
$errorList = array();
$i = 1;
foreach ($studentData as $student) {
$validator = Validator::make($student, ['stud_idno' => 'unique:students|regex:/^\\d{2}-+\\d{4}$/', 'lastname' => 'min:2', 'firstname' => 'min:2']);
if ($validator->fails()) {
foreach ($validator->errors()->all() as $err) {
$errorList[] = 'Line ' . $i . ' - ' . $err;
}
} else {
$stud = new Student();
$stud->student_guid = Uuid::uuid();
$stud->stud_idno = $student['stud_idno'];
$stud->firstname = $student['firstname'];
$stud->middlename = $student['middlename'];
$stud->lastname = $student['lastname'];
$stud->college = $student['college'];
$stud->course = $student['course'];
$stud->yr_sec = $student['yr_sec'];
$stud->save();
}
$i++;
}
return $errorList;
}
示例3: addStudent
public function addStudent(Request $request)
{
// $request = new Request;
$name = $this->clean($request->input('student-name'));
$code = $this->clean($request->input('student-code'));
$address = $this->clean($request->input('student-address'));
$dob = $this->clean($request->input('student-dob'));
$genderInp = $this->clean($request->input('gender'));
if ($genderInp == "male") {
$gender = "Nam";
} else {
$gender = "Nữ";
}
if ($name != "" && $code != "" && $address != "" && $dob != "") {
$student = new Student();
$student->name = $name;
$student->student_code = $code;
$student->dob = $dob;
$student->gender = $gender;
$student->address = $address;
$student->save();
Session::set('messsage', 'Tác vụ thành công !');
return Redirect::to(url('student'))->with('message', 'Tác vụ thành công !');
}
return view('student/add');
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Requests\CreateStudentRequest $request)
{
$data = $request->all();
$student = new Student($data);
$student->save();
return redirect()->route('admin.student.index');
}
示例5: fetchAllNoregisterInfo
public static function fetchAllNoregisterInfo($currentSheet, $force = false)
{
$arr = array();
$arr['type'] = '未报到';
$arr['success'] = 0;
$arr['new'] = 0;
$arr['update'] = 0;
$arr['keep'] = 0;
$arr['fail'] = 0;
$arr['note'] = '';
$highestRow = $currentSheet->getHighestRow();
// 取得总行数
$highestColumm = $currentSheet->getHighestColumn();
// 取得总列数
$highestColumm = PHPExcel_Cell::columnIndexFromString($highestColumm);
for ($row = 2; $row <= $highestRow; $row++) {
$item = array();
//$item = array('number 0' =>'', 'type 1' => '', 'nationality 2' => '', 'stu_id 3' => '', 'name_cn 4' => '', 'name_en 5' => '',
// 'csc_no 6' => '', 'passport_id 7' => '', 'sex 8' => '', 'birthday 9' => '', 'school 10' => '', 'major 11' => '',
// 'admission_date 12' => '', 'old_class 13' => '', 'new_class 14' => '', 'language 15' => '', 'fee 16' => '',
// 'address 17' => '', 'telephone 18' => '', 'email 19' => '', 'note1 20' => '', 'note2 21' => '');
for ($column = 0; $column < $highestColumm; $column++) {
$columnName = PHPExcel_Cell::stringFromColumnIndex($column);
$item[$column] = $currentSheet->getCellByColumnAndRow($column, $row)->getValue();
}
if ($item[3]) {
} else {
$arr['fail']++;
$arr['note'] = '学号不能为空!';
continue;
}
$item[3] = strtoupper($item[3]);
$student = Student::find($item[3]);
if ($student && $force) {
//已存在,强制时处理
$student->id = $item[3];
$student->type = $item[1];
$student->nationality = $item[2];
$student->name_cn = $item[4];
$student->name_en = $item[5];
$student->csc_no = $item[6];
$student->passport_id = $item[7];
$student->gender = $item[8];
$student->birthday = $item[9];
$student->school = $item[10];
$student->major = $item[11];
$student->admission_date = $item[12];
$student->old_class = $item[13];
$student->new_class = $item[14];
$student->language = $item[15];
$student->fee_type = $item[16];
$student->inschool_address = $item[17];
$student->telephone = $item[18];
$student->email = $item[19];
$student->tutor = $item[20];
$student->inschool_note1 = $item[21];
$student->inschool_note2 = $item[22];
$student->stu_type = '未报到';
$student->save();
$arr['success']++;
$arr['update']++;
} else {
if (!$student) {
$student = new Student();
$student->id = $item[3];
$student->type = $item[1];
$student->nationality = $item[2];
$student->name_cn = $item[4];
$student->name_en = $item[5];
$student->csc_no = $item[6];
$student->passport_id = $item[7];
$student->gender = $item[8];
$student->birthday = $item[9];
$student->school = $item[10];
$student->major = $item[11];
$student->admission_date = $item[12];
$student->old_class = $item[13];
$student->new_class = $item[14];
$student->language = $item[15];
$student->fee_type = $item[16];
$student->inschool_address = $item[17];
$student->telephone = $item[18];
$student->email = $item[19];
$student->tutor = $item[20];
$student->inschool_note1 = $item[21];
$student->inschool_note2 = $item[22];
$student->stu_type = '未报到';
$student->save();
$arr['success']++;
$arr['new']++;
} else {
$arr['success']++;
$arr['keep']++;
}
}
}
return $arr;
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$student = new Student();
$data = $request->all();
$student->fill($data);
$student->save();
return redirect('classrooms/' . $data["classroom_id"]);
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$student = new Student();
$student->sernum = $request->sernum;
$student->category_id = $request->category_id;
$student->lastname = $request->lastname;
$student->firstname = $request->firstname;
$student->email = $request->email;
$student->save();
return redirect()->route('student.index');
}
示例8: information
/**
* @param Student $stud
* @return \Illuminate\View\View
*/
public function information(Student $stud)
{
//$stud=new Student();
$stud->name = 'khan';
$stud->father_name = "baap of khan";
$stud->roll_number = "420";
$stud->save();
//$info = $stud::withTrashed();
//$info->delete();
//$stud->destroy(4);
return view('songs.song', compact('info'));
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$student = new Student();
$student->imie = $request->imie;
$student->nazwisko = $request->nazwisko;
$student->adres = $request->adres;
$student->kod_pocztowy = $request->kod_pocztowy;
$student->miejscowosc = $request->miejscowosc;
$student->telefon = $request->telefon;
$student->save();
return redirect('students');
}
示例10: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
/**************
ADMIN DB ENTRY*
**************/
$user = new User();
$user->username = "nelabh";
$user->password = Hash::make('helloworld');
$user->level = 0;
$user->save();
/**************
TEACHER DB ENTRY*
**************/
$user = new User();
$user->username = "nelabhteach";
$user->password = Hash::make('helloworld');
$user->level = 2;
$user->save();
/**************
STUDENT DB ENTRY*
**************/
$user = new User();
$user->username = "nelabhstudent";
$user->password = Hash::make('helloworld');
$user->level = 1;
$user->save();
// $this->call(UsersTableSeeder::class);
/**************
STUDENT DB ENTRY*
**************/
$student = new Student();
$student->name = "Sahil Kumar Maurya";
$student->username = "nelabhstudent";
$student->email = "sahil.kr.maurya@gmail.com";
$student->phone_no = 1234567890;
$student->admission_year = 2014;
$student->course = "Bachelor of Technology";
$student->branch = "Computer Science Engineering";
$student->save();
/**************
TEACHER DB ENTRY*
**************/
$staff = new Staff();
$student->name = "S.K. Maurya";
$student->username = "nelabhteach";
$student->email = "sahil.kr.maurya@gmail.com";
$student->phone_no = 1234567890;
$student->type = 1;
$student->subject = "Networking";
$student->depart = "Computer Science Engineering";
$staff->save();
}
示例11: store
public function store(Request $request)
{
$validator = Validator::make($request->all(), ['full_name' => 'required', 'email' => 'required', 'phone' => 'required', 'address' => 'required']);
if ($validator->fails()) {
return redirect('student.create')->withErrors($validator)->withInput();
}
$data = new Student();
$data->full_name = \Request::input('full_name');
$data->email = \Request::input('email');
$data->phone = \Request::input('phone');
$data->address = \Request::input('address');
$data->save();
return Redirect('student');
}
示例12: store
/**
* Store a newly created resource in storage.
* @param RegisterStudentRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(RegisterStudentRequest $request)
{
$student = new Student($request->except(['department_code']));
$date = strtotime($request->input('current_date'));
$student->current_date = date('d/m/Y', $date);
// Changed string date to Date format
$department = Department::where('code', $request->input('department_code'))->first();
$student->registration_no = $department->name . '-' . date('Y', $date) . '-' . sprintf("%03d", $department->students->count() + 1);
// Create Student registration no.
$student->department()->associate($department);
$student->save();
$student_request = new UserRequestHandle('Student', $request->input('email'));
$student_request->save();
$request->session()->flash('status', 'Student registration was successful!');
return back();
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//First an empty instance of the object:
$student = new Student();
//Then assign the data from the form to that object
$student->first = $request->first;
$student->last = $request->last;
$student->remarks = $request->remarks;
//Save the data in the database
if (!$student->save()) {
$errors = $student->getErrors();
//Redirect back to the create page and pass along the errors
return redirect()->action('StudentController@create')->with('errors', $errors)->withInput();
}
//Sucessfully created
return redirect()->action('StudentController@index')->with('message', '<div class="alert alert-success">Student added successfully</div>');
}
示例14: registerStudent
public function registerStudent(Request $request, Student $student)
{
$student->first_name = $request->get('firstname');
$student->middle_name = $request->get('middlename');
$student->last_name = $request->get('lastname');
$student->level = $request->get('level');
$student->matric_no = $request->get('matricno');
$student->dob = $request->get('dob');
$student->sex = $request->get('sex');
$student->state_of_origin = $request->get('state');
$student->lga_of_origin = $request->get('lga');
$student->user_id = auth()->user()->id;
try {
$student->save();
} catch (QueryException $e) {
return $e->getMessage();
}
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$students = new Student();
$students->nim = Input::get('nim');
$students->name = Input::get('name');
$students->classroom = Input::get('classroom');
$students->faculty_code = Input::get('faculty_code');
$students->study_id = Input::get('study_id');
$students->program_study_id = Input::get('program_study_id');
$students->academic_registration_id = Input::get('academic_registration_id');
$students->email = Input::get('email');
$students->password = Hash::make(Input::get('password'));
$students->religion_id = Input::get('religion_id');
$students->address = Input::get('address');
$students->phone = Input::get('phone');
$students->comments = Input::get('comments');
$students->active = Input::get('active');
$students->save();
Session::flash('message', 'You have successfully added student');
return Redirect::to('dashboard/admin/students');
}