本文整理汇总了PHP中app\models\Log::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::find方法的具体用法?PHP Log::find怎么用?PHP Log::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Log
的用法示例。
在下文中一共展示了Log::find方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* @return string
*/
public function actionIndex()
{
$low_stock_items = Item::find()->where('quantity >= 1 AND quantity <= 10')->all();
$empty_stock_items = Item::find()->where('quantity = 0')->all();
$logs = Log::find()->orderBy('created_at DESC')->limit(10)->all();
return $this->render('index', ['low_stock_items' => $low_stock_items, 'empty_stock_items' => $empty_stock_items, 'logs' => $logs]);
}
示例2: actionView
/**
* Displays a single Goal model.
* @param $alias
* @return mixed
*/
public function actionView($alias)
{
$goal = $this->findModel(['alias' => $alias]);
$id = $goal->id;
$logRows = Log::find()->where(['goal_id' => $id])->orderBy('created_at DESC')->limit(5)->all();
$taskQuery = Task::find()->where(['goal_id' => $id, 'closed' => 0])->orderBy('date')->limit(5);
$taskRows = $taskQuery->all();
$taskCount = $taskQuery->count();
return $this->render('view', ['goal' => $goal, 'logRows' => $logRows, 'taskRows' => $taskRows, 'taskCount' => $taskCount, 'logModel' => new Log(['goal_id' => $id])]);
}
示例3: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Log::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id, 'equipment_id' => $this->equipment_id, 'user_id' => $this->user_id, 'status_id' => $this->status_id, 'date' => $this->date, 'room_id' => $this->room_id, 'log_type_id' => $this->log_type_id]);
$query->andFilterWhere(['like', 'location', $this->location]);
return $dataProvider;
}
示例4: actionIndex
public function actionIndex()
{
$data = Log::find()->orderBy('time DESC');
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '10']);
$model = $data->offset($pages->offset)->limit($pages->limit)->all();
if ($page = \Yii::$app->request->get('page')) {
if (intval(ceil($data->count() / 10)) < $page) {
return false;
}
return $this->renderAjax('_list', ['model' => $model]);
}
return $this->render('index', ['model' => $model]);
}
示例5: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Log::find()->orderBy(['id' => SORT_DESC]);
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 200]]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id]);
$query->andFilterWhere(['like', 'login', $this->login])->andFilterWhere(['like', 'action', $this->action])->andFilterWhere(['like', 'date', $this->date]);
return $dataProvider;
}
示例6: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Log::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id, 'goal_id' => $this->goal_id]);
$query->andFilterWhere(['like', 'data', $this->data])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'created_at', $this->created_at]);
return $dataProvider;
}
示例7: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Log::find();
$query->joinWith(['user', 'logType', 'equipment.equipmentType', 'equipment', 'location.room', 'location', 'equipmentStatus']);
$dataProvider = new ActiveDataProvider(['query' => $query]);
$dataProvider->sort->attributes['user'] = ['asc' => ['user.name' => SORT_ASC], 'desc' => ['user.name' => SORT_DESC]];
$dataProvider->sort->attributes['logType'] = ['asc' => ['log_type.type' => SORT_ASC], 'desc' => ['log_type.type' => SORT_DESC]];
$dataProvider->sort->attributes['equipmentType'] = ['asc' => ['equipment_type.name' => SORT_ASC], 'desc' => ['equipment_type.name' => SORT_DESC]];
$dataProvider->sort->attributes['equipment'] = ['asc' => ['equipment.inventory' => SORT_ASC], 'desc' => ['equipment.inventory' => SORT_DESC]];
$dataProvider->sort->attributes['available'] = ['asc' => ['equipment.available' => SORT_ASC], 'desc' => ['equipment.available' => SORT_DESC]];
$dataProvider->sort->attributes['room'] = ['asc' => ['room.name' => SORT_ASC], 'desc' => ['room.name' => SORT_DESC]];
$dataProvider->sort->attributes['location'] = ['asc' => ['location.location' => SORT_ASC], 'desc' => ['location.location' => SORT_DESC]];
$dataProvider->sort->attributes['equipmentStatus'] = ['asc' => ['equipment_status.status' => SORT_ASC], 'desc' => ['equipment_status.status' => SORT_DESC]];
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id]);
$query->andFilterWhere(['like', 'user.name', $this->user])->andFilterWhere(['like', 'log_type.type', $this->logType])->andFilterWhere(['like', 'equipment_type.name', $this->equipmentType])->andFilterWhere(['like', 'equipment.inventory', $this->equipment])->andFilterWhere(['like', 'equipment.available', $this->available])->andFilterWhere(['like', 'room.name', $this->room])->andFilterWhere(['like', 'location.location', $this->location])->andFilterWhere(['like', 'date', $this->date])->andFilterWhere(['like', 'equipment_status.status', $this->equipmentStatus]);
return $dataProvider;
}
示例8: actionAdmin
/**
* Lists all Log models.
* @return mixed
*/
public function actionAdmin()
{
$dataProvider = new ActiveDataProvider(['query' => Log::find()]);
return $this->render('admin', ['dataProvider' => $dataProvider]);
}
示例9: if
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'answer')->textInput(['class' => 'input'])->label('');
?>
<div class="form-group">
<?php
echo Html::submitButton('отправить код', ['class' => 'button--submit']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
<div class="answer__header">Ответ:</div>
<div>
<? if ($model->is_answer_activate == 1): ?>
<img src="<?php
echo $model->map_url;
?>
">
<? endif; ?>
</div>
<div class="log__header">Лог игры:</div>
<?php
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => \app\models\Log::find()->where(['challenge_id' => $model->id])->orderBy('id DESC')]), 'layout' => "{items}", 'columns' => ['time', 'text', 'answer']]);
?>
</div>
示例10: run
public function run()
{
$dataProvider = new ActiveDataProvider(['query' => Log::find()->where(['model' => $this->model, 'model_id' => $this->model_id])->orderBy('id DESC')]);
return $this->render('logsGridWidget', ['dataProvider' => $dataProvider]);
}
示例11: actionIndex
public function actionIndex()
{
$dataProvider = new ActiveDataProvider(['query' => Log::find()->orderBy('log_time desc')]);
return $this->render('index', array('dataProvider' => $dataProvider));
}
示例12: actionLogs
function actionLogs()
{
$logs = Log::find()->where("ip NOT IN('192.168.1.1', '127.0.0.1', '213.87.126.229')")->orderBy('id DESC')->limit(50)->all();
return $this->renderPartial('logs', ['logs' => $logs]);
}