本文整理汇总了PHP中Logs::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Logs::select方法的具体用法?PHP Logs::select怎么用?PHP Logs::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logs
的用法示例。
在下文中一共展示了Logs::select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$student = Student::find($id);
if ($student == NULL) {
throw new Exception('Invalid Student ID');
}
$student->year = (int) substr($student->year, 2, 4);
$student_category = StudentCategories::find($student->category);
$student->category = $student_category->category;
$student_branch = Branch::find($student->branch);
$student->branch = $student_branch->branch;
if ($student->rejected == 1) {
unset($student->approved);
unset($student->books_issued);
$student->rejected = (bool) $student->rejected;
return $student;
}
if ($student->approved == 0) {
unset($student->rejected);
unset($student->books_issued);
$student->approved = (bool) $student->approved;
return $student;
}
unset($student->rejected);
unset($student->approved);
$student_issued_books = Logs::select('book_issue_id', 'issued_at')->where('student_id', '=', $id)->orderBy('time_stamp', 'desc')->take($student->books_issued)->get();
foreach ($student_issued_books as $issued_book) {
$issue = Issue::find($issued_book->book_issue_id);
$book = Books::find($issue->book_id);
$issued_book->name = $book->title;
$issued_book->issued_at = date('d-M', $issued_book->issued_at);
}
$student->issued_books = $student_issued_books;
return $student;
}
示例2: logAction
function logAction()
{
$t = new Logs();
$this->metas(array('DC.Title' => 'Journal système'));
$this->branche->append();
$s = $t->select()->from('log')->order('date DESC');
$this->view->events = new Strass_Pages_Model_Rowset($s, 30, $this->_getParam('page'));
}
示例3: index
public function index()
{
$logs = Logs::select('id', 'book_issue_id', 'student_id', 'issued_at')->where('return_time', '=', 0)->orderBy('issued_at', 'DESC');
$logs = $logs->get();
for ($i = 0; $i < count($logs); $i++) {
$issue_id = $logs[$i]['book_issue_id'];
$student_id = $logs[$i]['student_id'];
// to get the name of the book from book issue id
$issue = Issue::find($issue_id);
$book_id = $issue->book_id;
$book = Books::find($book_id);
$logs[$i]['book_name'] = $book->title;
// to get the name of the student from student id
$student = Student::find($student_id);
$logs[$i]['student_name'] = $student->first_name . ' ' . $student->last_name;
// change issue date and return date in human readable format
$logs[$i]['issued_at'] = date('d-M', $logs[$i]['issued_at']);
$logs[$i]['return_at'] = date('d-M', $logs[$i]['issued_at'] + 1209600);
}
return $logs;
}
示例4: getDataStat
public function getDataStat()
{
$rs = Logs::select(DB::raw("count (*) "), "data_id", "data_name")->join("data", "data.id", '=', "logs.data_id")->groupBy("data_id", "data_name")->orderBy("data_id")->get();
return $rs;
}