-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnomad_controller.php
46 lines (43 loc) · 977 Bytes
/
nomad_controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* nomad class
*
* @package munkireport
* @author
**/
class Nomad_controller extends Module_controller
{
function __construct()
{
// Store module path
$this->module_path = dirname(__FILE__);
}
/**
* Get nomad information for serial_number
*
* @param string $serial serial number
**/
public function get_data($serial_number = '')
{
jsonView(
Nomad_model::select('nomad.*')
->whereSerialNumber($serial_number)
->filter()
->limit(1)
->first()
->toArray()
);
}
public function get_list($column = '')
{
jsonView(
Nomad_model::select($column . ' AS label')
->selectRaw('count(*) AS count')
->filter()
->groupBy($column)
->orderBy('count', 'desc')
->get()
->toArray()
);
}
}