/** * Store a new grade in database. * * @param Request $request * @param User $user * @param Submission $submission * @return \Illuminate\Http\RedirectResponse */ public function store(Request $request, User $user, Submission $submission) { $input = array_add($request->all(), 'submission_id', $submission->id); $input = array_add($input, 'user_id', $user->id); Grade::create($input); return redirect()->action('AdminController@mark', ['submission' => $submission]); }
/** * Run the database seeds. * * @return void */ public function run() { \App\Grade::create(array('school_id' => 1, 'grade' => '1年')); \App\Grade::create(array('school_id' => 1, 'grade' => '2年')); \App\Grade::create(array('school_id' => 1, 'grade' => '3年')); \App\Grade::create(array('school_id' => 1, 'grade' => '4年')); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('users')->delete(); User::create(['id' => 1210311232, 'name' => '李锐', 'password' => Hash::make('1210311232')]); User::create(['id' => 1210311233, 'name' => '陈曦', 'password' => Hash::make('1210311233')]); User::create(['id' => 1234567890, 'name' => '管理员', 'password' => Hash::make('root'), 'is_admin' => 1]); Grade::create(['user_id' => 1210311232, 'math' => 99, 'english' => 80, 'c' => 96, 'sport' => 95, 'think' => 99, 'soft' => 98]); Grade::create(['user_id' => 1210311233]); }
public function store(Request $request) { $rules = ['name' => 'required|unique:grades|min:4|max:255', 'description' => 'min:4|max:255']; $messages = ['name.required' => 'Es necesario definir un nombre.', 'name.unique' => 'Los grados deben tener un nombre único.', 'name.min' => 'Ingrese un nombre adecuado.', 'description.min' => 'Ingrese una descripción adecuada.']; $v = Validator::make($request->all(), $rules, $messages); if ($v->fails()) { return back()->withErrors($v)->withInput(); } Grade::create($request->all()); return back()->with('success', 'Grado registrado exitosamente.'); }
/** * Run the database seeds. * * @return void */ public function run() { Grade::create(['name' => 'Pre-kinder', 'description' => 'Para niños de 2 y 3 años.']); Grade::create(['name' => 'Kinder', 'description' => 'Para niños de 4 y 5 años.']); Grade::create(['name' => 'Primer grado']); Grade::create(['name' => 'Segundo grado']); Grade::create(['name' => 'Tercer grado']); Grade::create(['name' => 'Cuarto grado']); Grade::create(['name' => 'Quinto grado']); Grade::create(['name' => 'Sexto grado']); Grade::create(['name' => 'Primer año']); Grade::create(['name' => 'Segundo año']); Grade::create(['name' => 'Tercer año']); Grade::create(['name' => 'Cuarto año']); Grade::create(['name' => 'Quinto año']); }
public function run() { //Empty the Grade table // DB::table('Grade')->delete(); Grade::truncate(); Grade::create(['id' => '1', 'name' => "7 Kyu", 'order' => 1]); Grade::create(['id' => '2', 'name' => "6 Kyu", 'order' => 2]); Grade::create(['id' => '3', 'name' => "5 Kyu", 'order' => 3]); Grade::create(['id' => '4', 'name' => "4 Kyu", 'order' => 4]); Grade::create(['id' => '5', 'name' => "3 Kyu", 'order' => 5]); Grade::create(['id' => '6', 'name' => "2 Kyu", 'order' => 6]); Grade::create(['id' => '7', 'name' => "1 Kyu", 'order' => 7]); Grade::create(['id' => '8', 'name' => "1 Dan", 'order' => 8]); Grade::create(['id' => '9', 'name' => "2 Dan", 'order' => 9]); Grade::create(['id' => '10', 'name' => "3 Dan", 'order' => 10]); Grade::create(['id' => '11', 'name' => "4 Dan", 'order' => 11]); Grade::create(['id' => '12', 'name' => "5 Dan", 'order' => 12]); Grade::create(['id' => '13', 'name' => "6 Dan", 'order' => 13]); Grade::create(['id' => '14', 'name' => "7 Dan", 'order' => 14]); Grade::create(['id' => '15', 'name' => "8 Dan", 'order' => 15]); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $grade = Grade::create(['grade' => ucwords($request->grade), 'grade_section' => ucwords($request->grade_section), 'school_id' => $request->school_id, 'student_id' => $request->student_id]); return redirect('admin/createclass')->withInput(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $grades = Grade::create(['grade' => ucwords($request->grade), 'grade_section' => $request->grade_section, 'school_id' => $request->school_id]); return redirect('principal/create#grade-tab')->withInput(); }
public function postAdd(addGrade $request) { if (\App\Grade::create($request->only(['grade_name', 'grade_info']))) { return view('admin.grade.add')->with(['msg' => 'Add grade success!']); } }