예제 #1
0
 /**
  * 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');
 }
예제 #2
0
 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
0
 /**
  * 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"]);
 }
 public function destroy(Request $request, Student $student)
 {
     $student->delete();
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($student);
     }
     return redirect('students');
 }
예제 #5
0
 /**
  * @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'));
 }
예제 #6
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /**************
       	ADMIN DB ENTRY*
       	**************/
     $user = new User();
     $user->username = "******";
     $user->password = Hash::make('helloworld');
     $user->level = 0;
     $user->save();
     /**************
       	TEACHER DB ENTRY*
       	**************/
     $user = new User();
     $user->username = "******";
     $user->password = Hash::make('helloworld');
     $user->level = 2;
     $user->save();
     /**************
       	STUDENT DB ENTRY*
       	**************/
     $user = new User();
     $user->username = "******";
     $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 = "******";
     $student->email = "*****@*****.**";
     $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 = "******";
     $student->email = "*****@*****.**";
     $student->phone_no = 1234567890;
     $student->type = 1;
     $student->subject = "Networking";
     $student->depart = "Computer Science Engineering";
     $staff->save();
 }
예제 #7
0
 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');*/
 }
예제 #8
0
 protected static function boot()
 {
     // TODO send email with randomly generated password
     Student::created(function ($student) {
         $student->university->user()->create(['name' => $student->first_name . ' ' . $student->last_name, 'email' => $student->email, 'password' => bcrypt('1234'), 'role' => 'student']);
     });
 }
예제 #9
0
 public function editName(Request $request)
 {
     $id = $request->input('id');
     $fullname = $request->input('fullname');
     $this->student->findOrFail($id)->update(['fullname' => $fullname]);
     return response()->json(['status' => 1, 'fullname' => $fullname]);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('students', function ($id) {
         return \App\Student::where('id', $id)->firstOrFail();
     });
     parent::boot($router);
 }
예제 #11
0
 /**
  * @param StudentSearch $request
  * @return mixed
  */
 private function createQuery(StudentSearch $request)
 {
     if (!$this->search->createQuery($request->all())) {
         return Student::orderBy('last_name', 'ASC')->paginate(10);
     }
     return $this->search->createQuery($request->all())->paginate(10);
 }
 public function getStudent($id)
 {
     if (Request::ajax()) {
         $student = Student::with('college', 'course', 'scholarship', 'educationalBackground', 'familyBackground', 'academicPerformance', 'organizationalAffiliation', 'psychologicalTest', 'activityParticipated', 'counsellingRecord', 'absentRecord')->where('students.id', $id)->get();
         return $student;
     }
 }
 public function time()
 {
     $client = new Client(['base_uri' => config('bootysys.base_url'), 'timeout' => 2.0]);
     $professor = Student::all();
     $req = $client->request('POST', '/receive', ['json' => ['professors' => $professor]]);
     return collect(['body' => $req->getBody()->getContents()]);
 }
 /**
  * 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);
     }
 }
예제 #15
0
 public function generate($id)
 {
     $college = $this->checkCollege($id);
     $students = Student::where('college', 'LIKE', '%' . $college . '%')->orderBy('lastname')->get();
     $pdf = \PDF::loadView('layouts.spreadsheet', compact('students'));
     //return view('layouts.spreadsheet', compact('students'));
     return $pdf->download('test.pdf');
 }
 public function up($id)
 {
     $dateNow = time();
     $student = Student::findOrFail($id);
     $student->update(['status' => 1, 'registered_at' => $dateNow]);
     session()->flash('flash_message', 'Anda telah melakukan perpanjangan masa aktif siswa!');
     return redirect()->route('settings.student');
 }
예제 #17
0
 public function students()
 {
     if (!Session::has('admin')) {
         return redirect('/admin/login');
     }
     $students = Student::where('validated', true)->get();
     return view('admin/students', ['students' => $students]);
 }
 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']);
 }
예제 #19
0
 /**
  * Export students (query in session) to excel
  *
  * @return mixed
  */
 public function export()
 {
     $students = session()->has('students') ? session('students')->get() : Student::get();
     return \Excel::create('Students', function ($excel) use($students) {
         $excel->sheet('students', function ($sheet) use($students) {
             $sheet->fromArray($students->toArray());
         });
     })->download('xls');
 }
예제 #20
0
 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]);
     }
 }
예제 #21
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $learners = \App\Student::all();
     $staff = Staff::all();
     $subjects = \App\Subject::all();
     $streams = \App\Stream::all();
     $classes = \App\Grade::all();
     return view('admin.index')->with('title', 'SMS|Dashboard')->with('learners', $learners)->with('staff', $staff)->with('subjects', $subjects)->with('streams', $streams)->with('classes', $classes);
 }
예제 #22
0
 public function destroy($student_id)
 {
     $student = Student::find($student_id);
     if ($student) {
         $student->courses()->detach();
         $student->delete();
         return $this->createSuccessResponse("The student with id {$student_id} has been removed", 200);
     }
     return $this->createErrorResponse('The student with the specified id does not exists');
 }
예제 #23
0
 public function search()
 {
     $keyword = Input::get('keyword');
     if (count(explode(" ", $keyword)) > 1) {
         $students = Student::where('ime_studenta', 'LIKE', explode(" ", $keyword)[1] . '%')->where('priimek_studenta', 'LIKE', explode(" ", $keyword)[0] . '%')->orwhere('ime_studenta', 'LIKE', explode(" ", $keyword)[0] . '%')->where('priimek_studenta', 'LIKE', explode(" ", $keyword)[1] . '%')->get();
     } else {
         $students = Student::where('ime_studenta', 'LIKE', $keyword . '%')->orWhere('priimek_studenta', 'LIKE', $keyword . '%')->orWhere('vpisna_stevilka', $keyword)->get();
     }
     return view('seznamstudentov', ['students' => $students, 'tip' => Auth::user()->type]);
 }
예제 #24
0
 public function run()
 {
     $faker = Faker::create();
     $courseIds = Course::lists('id')->all();
     $studentIds = Student::lists('id')->all();
     //        dd($studentIds);
     foreach (range(1, count($courseIds)) as $index) {
         DB::table('course_student')->insert(['course_id' => $faker->randomElement($courseIds), 'student_id' => $faker->randomElement($studentIds)]);
     }
 }
예제 #25
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $students = Student::find($id);
     $faculties = Faculty::lists('faculty_name', 'faculty_code');
     $studies = Study::lists('study_name', 'id');
     $programStudies = ProgramStudy::lists('name', 'id');
     $academicRegistrations = AcademicRegistration::lists('academic_year', 'id');
     $religions = Religion::lists('name', 'id');
     return view('dashboard.admin.student.edit', ['student' => $students, 'faculty' => $faculties, 'study' => $studies, 'programStudy' => $programStudies, 'academicRegistration' => $academicRegistrations, 'religion' => $religions]);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     //versione semplice
     //$router->model('users', \App\User::class);
     //funziona sempre e anche per fare filtri su campi diversi da id
     $router->bind('students', function ($id) {
         return \App\Student::where('id', $id)->firstOrFail();
     });
 }
예제 #27
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateParentRequest $request)
 {
     $parent = new Guardian(array('firstname' => $request->firstname, 'lastname' => $request->lastname, 'middlename' => $request->middle_name, 'phone' => $request->phone, 'district' => $request->district, 'home_address' => $request->home_address, 'office_address' => $request->office_address, 'occupation' => $request->occupation, 'email' => $request->email));
     $student = \App\Student::find($request->student_id);
     $parent = $student->guardians()->save($parent, ['relation' => $request->relation]);
     if ($parent) {
         return \Redirect::route('learners')->with('message', 'Parent successfuly registered!');
     } else {
         return \Redirect::route('learners')->with('error-message', 'Failed to register Parent!');
     }
 }
예제 #28
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['contact11' => 'integer|min:1000000000|max:9999999999', 'contact12' => 'integer|max:9999999999', 'std_pincode' => 'integer']);
     $studentData = Student::findOrFail($id);
     $studentAdds = $studentData->addresses->flatten()->toArray();
     foreach ($studentAdds as $key => $value) {
         $studentAdd = $value;
     }
     $addressData = Address::findOrFail($studentAdd['id']);
     $addressData->update(['contact11' => $request->contact11, 'contact12' => $request->contact12, 'add1' => ucwords($request->add1), 'add2' => ucwords($request->add2), 'street' => ucwords($request->street), 'pincode' => $request->pincode]);
     return Redirect::route('student.show', ['student' => $addressData]);
 }
예제 #29
0
 function index()
 {
     return "success";
     //$students = \App\Student::where('first_name','=','Jin')->get();
     //return $students;
     //$student= new App\Student();
     //$student->first_name='Varaly';
     //$student->last_name='Cario';
     //$student->save();
     $students = \App\Student::all();
     return view('students', ['students' => $students]);
 }
 /**
  * This function sends a verification
  * mail with code to the students.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function sendVerifiactionMail()
 {
     // Get currently logged in student
     $student = Student::find(Auth::guard('student')->user()->rollNo);
     $verificationCode = $this->generateVerificationCode($student->rollNo);
     $student->verificationCode = $verificationCode;
     $student->save();
     Mail::queue('student.auth.emails.verification', ['student' => $student], function ($msg) use($student) {
         $msg->from('*****@*****.**', 'Support');
         $msg->to($student->email, $student->name)->subject('Your Verification code');
     });
     $statusMsg = 'Verification code successfully sent on ' . $student->email;
     return redirect()->back()->with('status', $statusMsg);
 }