1
0
Fork 0
mirror of https://github.com/janickiy/yii2-nomer synced 2025-03-09 15:39:59 +00:00
yii2-nomer/modules/admin/controllers/CheckoutsController.php
2020-02-05 06:34:26 +03:00

26 lines
No EOL
691 B
PHP

<?php
namespace app\modules\admin\controllers;
use app\models\Checkout;
use yii\data\ActiveDataProvider;
use yii\db\Expression;
use yii\web\Controller;
class CheckoutsController extends AdminController {
public function actionIndex() {
$dataProvider = new ActiveDataProvider([
"query" => Checkout::find()->where(["tm_done" => null])
]);
return $this->render("index", ["dataProvider" => $dataProvider]);
}
public function actionDone($id) {
$checkout = Checkout::find()->where(["id" => $id])->one();
$checkout->tm_done = new Expression("NOW()");
$checkout->save();
return $this->redirect(["index"]);
}
}