本文整理汇总了PHP中app\models\Student::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::all方法的具体用法?PHP Student::all怎么用?PHP Student::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Student
的用法示例。
在下文中一共展示了Student::all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* 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: index
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: getIndex
function getIndex()
{
$data['list_students'] = Student::all();
return view('hocsinh.index')->with('data', $data);
}
示例4: exportStudentList
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);
}
示例5: all
/**
* Returns all Students
*
* @return \Illuminate\Database\Eloquent\Collection|static[]
*/
public function all()
{
return Student::all();
}