当前位置: 首页>>代码示例>>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;未经允许,请勿转载。