Пример #1
0
 public function run()
 {
     $faker = faker::create();
     foreach (range(1, 10) as $index) {
         student::create(array('name' => $faker->Name(), 'address' => $faker->address(), 'roll' => $faker->numberBetween($min = 1, $max = 200), 'age' => $faker->numberBetween($min = 10, $max = 20), 'created_at' => $faker->dateTimeBetween('now', '+14 days')));
     }
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     //DB::table('students')->delete();
     $student1 = student::create(['name' => 'aul', 'major' => 'IF']);
     $student2 = student::create(['name' => 'lala', 'major' => 'IF']);
 }
Пример #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StudentRequest $request)
 {
     //
     // $student= new student;
     // $student->name=Request::get('name');
     // $student->major=Request::get('major');
     // $student->save();
     student::create($request->all());
     return redirect('students');
     //return $student;
 }
 public function add_stud(Request $request)
 {
     $input = $request->all();
     $input['created_at'] = Carbon::now();
     $input['updated_at'] = Carbon::now();
     student::create($input);
     $values = DB::select("select sf.code, fid from subfacrels as sf inner join subjects as s on sf.code = s.code where sem like '%" . $input['sem'] . "%' and branch like '%" . $input['branch'] . "%' and secs like '%" . $input['section'] . "%'");
     foreach ($values as $key => $value) {
         DB::insert('insert into relations (enid, code, fid, attended, total, created_at, updated_at) values (?, ?, ?, ?, ?, ?, ?)', [$input['enid'], $value->code, $value->fid, 0, 0, Carbon::now(), Carbon::now()]);
     }
     return view('admin.admin_master');
 }
Пример #5
0
 public function run()
 {
     DB::table('students')->truncate();
     $skip = 0;
     $reader = Reader::createFromPath(base_path() . '/database/seeds/students.csv');
     foreach ($reader as $index => $row) {
         if ($skip) {
             student::create(['teamStyle' => $row[5], 'c' => $row[6], 'java' => $row[7], 'python' => $row[8], 'twoHundreds' => $row[9], 'threeHundreds' => $row[10], 'fourHundreds' => $row[11]]);
         } else {
             $skip = 1;
         }
     }
 }
Пример #6
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     \App\student::create([]);
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'admin' => false]);
 }
 public function shownew(Requests\NewStudentRequest $request)
 {
     student::create($request->all());
     return redirect('/');
 }