本文整理汇总了PHP中app\Student类的典型用法代码示例。如果您正苦于以下问题:PHP Student类的具体用法?PHP Student怎么用?PHP Student使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Student类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例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: 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"]);
}
示例4: destroy
public function destroy(Request $request, Student $student)
{
$student->delete();
if ($request->ajax() || $request->wantsJson()) {
return new JsonResponse($student);
}
return redirect('students');
}
示例5: 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'));
}
示例6: 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();
}
示例7: 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');*/
}
示例8: boot
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: boot
/**
* 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);
}
示例10: createQuery
/**
* @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);
}
示例11: getStudent
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;
}
}
示例12: time
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()]);
}
示例13: 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);
}
}
示例14: generate
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');
}
示例15: up
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');
}