/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     foreach (Student::all() as $student) {
         $picture = file_get_contents('http://local-sig.utt.fr/Pub/trombi/individu/' . $student->student_id . '.jpg');
         file_put_contents(public_path() . '/uploads/students-trombi/' . $student->student_id . '.jpg', $picture);
     }
     $this->info('Done!');
 }
예제 #2
0
 public function index()
 {
     $students = Student::all();
     foreach ($students as $student) {
         $user = $student->user()->first();
         $student['name'] = $user->name;
         $student['email'] = $user->email;
     }
     return $students;
 }
예제 #3
0
 function getIndex()
 {
     $data['list_students'] = Student::all();
     return view('hocsinh.index')->with('data', $data);
 }
예제 #4
0
 public function exportStudentList()
 {
     // work on the export
     $csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
     $csv->setOutputBOM(Reader::BOM_UTF8);
     $dbColumn = Input::get('hdndbColumn');
     $value = Input::get('hdnvalue');
     if ($dbColumn != "all") {
         $infos = Student::where($dbColumn, '=', $value)->orderBy('lname', 'asc')->get();
     } else {
         $infos = Student::all();
     }
     $headers = Schema::getColumnListing('student_record');
     $notInclude = ["id", "created_at", "updated_at"];
     $x = 0;
     foreach ($headers as $header) {
         if (in_array($header, $notInclude)) {
             unset($headers[$x]);
         }
         $x++;
     }
     $csv->insertOne($headers);
     foreach ($infos as $info) {
         $data = array();
         foreach ($headers as $header) {
             if ($header == "section") {
                 $data[count($data)] = $this->secInfo($info[$header])['description'];
             } elseif ($header == "year_lvl") {
                 $data[count($data)] = $this->yearInfo($info[$header])['description'];
             } else {
                 $data[count($data)] = $info[$header];
             }
         }
         $csv->insertOne($data);
     }
     $date_now = date('Y-m-d-H:i:s');
     $filename = 'student_record(' . $date_now . ').csv';
     $csv->output($filename);
 }
 /**
  * Returns all Students
  *
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function all()
 {
     return Student::all();
 }