本文整理汇总了PHP中orders::find方法的典型用法代码示例。如果您正苦于以下问题:PHP orders::find方法的具体用法?PHP orders::find怎么用?PHP orders::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orders
的用法示例。
在下文中一共展示了orders::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionStop
public function actionStop()
{
$orderNow = orders::find()->where(['active' => 1])->one();
$timeOld = $orderNow->time_total;
$timeBegin = new DateTime($orderNow->time_begin);
$timeEnd = new DateTime(date("Y-m-d H:i:s"));
$orderNow->active = 0;
$timeWork = $timeBegin->diff($timeEnd);
$MinutesWork = $timeWork->i + $timeWork->h * 60 + $timeWork->d * 60 * 24 + $timeOld;
$orderNow->time_total = $MinutesWork;
$orderNow->save();
Yii::$app->response->redirect(array('site/index'));
}
示例2:
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
$orderNow = orders::find()->where(['active' => TRUE])->one();
NavBar::begin(['options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo "<div class='col-sm-8'>";
echo '<span class="text-primary">';
if (isset($orderNow)) {
echo 'Ведется работа над заказом "' . $orderNow->work_dir . '". (ID = ' . $orderNow->ID . ') ';
echo "</span>";
Pjax::begin();
echo Html::a('Stop', ['site/stop'], ['class' => 'btn btn-info', 'id' => 'btnStop']);
Pjax::end();
} else {
echo 'Можно добавить новый заказ, либо продолжить работу над предыдущим';
echo "</span>";
}
echo "</div>";
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [Yii::$app->user->isGuest ? ['label' => 'Login', 'url' => ['/site/login']] : ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]]);