2016-12-29 01:55:00 +01:00
|
|
|
<?php
|
|
|
|
use Respect\Validation\Validator as DataValidator;
|
|
|
|
|
|
|
|
class GetLogsController extends Controller {
|
|
|
|
const PATH = '/get-logs';
|
2017-02-08 19:09:15 +01:00
|
|
|
const METHOD = 'POST';
|
2016-12-29 01:55:00 +01:00
|
|
|
|
|
|
|
public function validations() {
|
|
|
|
return [
|
|
|
|
'permission' => 'staff_1',
|
|
|
|
'requestData' => [
|
|
|
|
'page' => [
|
|
|
|
'validation' => DataValidator::numeric(),
|
|
|
|
'error' => ERRORS::INVALID_PAGE
|
|
|
|
]
|
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handler() {
|
2017-01-05 20:26:43 +01:00
|
|
|
$page = Controller::request('page');
|
2017-01-11 04:21:27 +01:00
|
|
|
$logList = Log::find('ORDER BY id desc LIMIT ? OFFSET ?', [10, 10*($page-1)]);
|
2016-12-29 06:04:35 +01:00
|
|
|
|
|
|
|
Response::respondSuccess($logList->toArray());
|
2016-12-29 01:55:00 +01:00
|
|
|
}
|
|
|
|
}
|