当前位置: 首页>>代码示例>>PHP>>正文


PHP Record::all方法代码示例

本文整理汇总了PHP中Record::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::all方法的具体用法?PHP Record::all怎么用?PHP Record::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Record的用法示例。


在下文中一共展示了Record::all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 /**
  * Display the specified dashboard.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $products = Product::all();
     $records = Record::all();
     $manufacturers = Manufacturer::all();
     return View::make('Dashboard.index', compact('records', 'products', 'manufacturers'));
 }
开发者ID:hunt-son,项目名称:inventory-app-2,代码行数:13,代码来源:DashboardsController.php

示例2: command

 public static function command($id)
 {
     if (Record::all()->count()) {
         $query = DB::select(DB::raw("SELECT DISTINCT *\n                                            FROM records\n                                            WHERE switch = '" . $id . "'\n                                            AND updated_at IN(\n                                            SELECT MAX(updated_at) \n                                            FROM records \n                                            GROUP BY id\n                                            )ORDER BY updated_at DESC;"));
         if ($query != null) {
             $record = $query[0];
             return $record->command;
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:14,代码来源:Record.php

示例3: uploadLog

 public function uploadLog($site_id, $switch, $status, $rfid, $created_at)
 {
     $page = 'log';
     $entry = new Record();
     $entry->site_id = $site_id;
     $entry->site_name = 'test';
     $entry->switch = $switch;
     if ($status) {
         $status_string = 'on';
         $command = 1;
     } else {
         $status_string = 'off';
         $command = 0;
     }
     $entry->status = $status_string;
     $entry->command = $command;
     $entry->rfid = $rfid;
     $entry->created_at = $created_at;
     $entry->save();
     $records = Record::all();
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:21,代码来源:RecordController.php

示例4: getPie

 public function getPie()
 {
     $start = 0;
     $end = 3;
     $page = 'reports';
     $graph = 'pie';
     $records = Record::all();
     $entries = [];
     $date = $records[0]->updated_at->month;
     while (sizeof($records) != 0) {
         $s1_hits = 0;
         $s2_hits = 0;
         $s3_hits = 0;
         $s4_hits = 0;
         $s5_hits = 0;
         $s6_hits = 0;
         foreach ($records as $key => $currentRecord) {
             $currentDate = $currentRecord->updated_at->month;
             if ($currentDate == $date) {
                 switch ($currentRecord->switch) {
                     case '1':
                         $s1_hits++;
                         break;
                     case '2':
                         $s2_hits++;
                         break;
                     case '3':
                         $s3_hits++;
                         break;
                     case '4':
                         $s4_hits++;
                         break;
                     case '5':
                         $s5_hits++;
                         break;
                     case '6':
                         $s6_hits++;
                         break;
                 }
                 unset($records[$key]);
             } else {
                 $data = "['Switch 1'" . ', ' . $s1_hits . ']';
                 array_push($entries, $data);
                 $data = "['Switch 2'" . ', ' . $s2_hits . ']';
                 array_push($entries, $data);
                 $data = "['Switch 3'" . ', ' . $s3_hits . ']';
                 array_push($entries, $data);
                 $data = "['Switch 4'" . ', ' . $s4_hits . ']';
                 array_push($entries, $data);
                 $data = "['Switch 5'" . ', ' . $s5_hits . ']';
                 array_push($entries, $data);
                 $data = "['Switch 6'" . ', ' . $s6_hits . ']';
                 array_push($entries, $data);
                 $date = $currentDate;
                 break;
             }
         }
     }
     $data = "['Door'" . ', ' . $s1_hits . ']';
     array_push($entries, $data);
     $data = "['Lights'" . ', ' . $s2_hits . ']';
     array_push($entries, $data);
     $data = "['Alarm'" . ', ' . $s3_hits . ']';
     array_push($entries, $data);
     $data = "['Generator'" . ', ' . $s4_hits . ']';
     array_push($entries, $data);
     $data = "['AC'" . ', ' . $s5_hits . ']';
     array_push($entries, $data);
     $data = "['Mains'" . ', ' . $s6_hits . ']';
     array_push($entries, $data);
     return View::make('reports.index')->with('page', $page)->with('reports', $entries)->with('start', $start)->with('end', $end)->with('graph', $graph);
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:72,代码来源:ReportController.php

示例5: index

 /**
  * Display a listing of records
  *
  * @return Response
  */
 public function index()
 {
     $records = Record::all();
     return View::make('Dashboard.index', compact('records'));
 }
开发者ID:hunt-son,项目名称:inventory-app-2,代码行数:10,代码来源:RecordsController.php


注:本文中的Record::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。