get logs from device

This commit is contained in:
2020-10-15 11:20:21 +07:00
parent 4a33ee9a7d
commit 53de75104e
11 changed files with 376 additions and 59 deletions

View File

@@ -0,0 +1,56 @@
<?php
namespace app\controllers;
use Yii;
use app\models\Logs;
use app\models\LogsSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* LogsController implements the CRUD actions for Logs model.
*/
class LogsController extends Controller {
public function init() {
parent::init();
if (Yii::$app->user->isGuest)
return $this->redirect(['/site/login']);
}
/**
* {@inheritdoc}
*/
public function behaviors() {
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
public function actionIndex() {
$this->view->title = 'Sự kiện hôm nay';
$searchModel = new LogsSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
protected function findModel($id) {
if (($model = Logs::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}