本文整理汇总了PHP中app\Student::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::create方法的具体用法?PHP Student::create怎么用?PHP Student::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Student
的用法示例。
在下文中一共展示了Student::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* @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');
}
示例2: store
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');*/
}
示例3: store
/**
* 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');
}
示例4: run
/**
* 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);
}
}
示例5: run
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']);
}
示例6: store
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!');
}
示例7: store
/**
* 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);
}
示例8: store
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');
}
示例9: run
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]);
}
}
示例10: store
/**
* 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');
}
示例11: store
/**
* 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!']);
}
示例12: store
/**
* 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();
}
示例13: run
/**
* 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' => 'dejesus.silvestre@yahoo.com', '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' => 'dejesus.silvestre@yahoo.com']);
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);
// }
}
示例14: store
/**
* 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'));
}
示例15: create
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');
}
}