本文整理汇总了PHP中app\models\File::query方法的典型用法代码示例。如果您正苦于以下问题:PHP File::query方法的具体用法?PHP File::query怎么用?PHP File::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\File
的用法示例。
在下文中一共展示了File::query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search($input)
{
$query = File::query();
$columns = Schema::getColumnListing('files');
$attributes = array();
foreach ($columns as $attribute) {
if (isset($input[$attribute]) and !empty($input[$attribute])) {
$query->where($attribute, $input[$attribute]);
$attributes[$attribute] = $input[$attribute];
} else {
$attributes[$attribute] = null;
}
}
return [$query->get(), $attributes];
}
示例2: function
});
}
});
}
});
JS
);
?>
<div class="container">
<div class="page-header">
<h1>Фото</h1>
</div>
<?php
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\File::query(), 'pagination' => ['pageSize' => 20]]), 'tableOptions' => ['class' => 'table table-hover'], 'columns' => ['id', ['header' => 'Картинка', 'content' => function ($item) {
return Html::a(Html::img($item['file'], ['class' => 'thumbnail', 'width' => 80, 'style' => 'margin-bottom: 0px;']), ['admin_files/edit', 'id' => $item['id']]);
}], ['header' => 'Название', 'content' => function ($item) {
return Html::a($item['title'], ['admin_files/edit', 'id' => $item['id']]);
}], ['header' => 'Удалить', 'content' => function ($item) {
return Html::button('Удалить', ['class' => 'btn btn-danger btn-xs buttonDelete', 'data-id' => $item['id']]);
}]]]);
?>
<a href="<?php
echo Url::to(['admin_files/add']);
?>
" class="btn btn-default">Добавить</a>
</div>
示例3: foreach
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\ContactForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
$this->title = 'Фотографии';
\app\assets\SlideShow\Asset::register($this);
?>
<div class="box">
<h1 class="title"><?php
echo $this->title;
?>
</h1>
<?php
foreach (\app\models\File::query()->all() as $foto) {
?>
<div class="foto" style="display: inline-block; margin: 10px;">
<a href="<?php
echo \cs\Widget\FileUpload2\FileUpload::getOriginal($foto['file']);
?>
" rel="lightbox[example]" class="highslide" onclick="return hs.expand(this)">
<img src="<?php
echo $foto['file'];
?>
" alt="Highslide JS">
</a>
</div>
<?php
}
?>
示例4: actionIndex
public function actionIndex()
{
return $this->render(['items' => File::query()->all()]);
}