當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Logs::select方法代碼示例

本文整理匯總了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;
 }
開發者ID:linpar,項目名稱:library-management-system,代碼行數:41,代碼來源:StudentController.php

示例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'));
 }
開發者ID:bersace,項目名稱:strass,代碼行數:8,代碼來源:AdminController.php

示例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;
 }
開發者ID:linpar,項目名稱:library-management-system,代碼行數:21,代碼來源:LogController.php

示例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;
 }
開發者ID:nattaphat,項目名稱:cuse2,代碼行數:5,代碼來源:Logs.php


注:本文中的Logs::select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。