本文整理匯總了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()]);
}