本文整理汇总了PHP中app\models\City::findById方法的典型用法代码示例。如果您正苦于以下问题:PHP City::findById方法的具体用法?PHP City::findById怎么用?PHP City::findById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\City
的用法示例。
在下文中一共展示了City::findById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
use app\models\City;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Transport */
$this->title = $model->transport_id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Transports'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="transport-view">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<p>
<?php
echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->transport_id], ['class' => 'btn btn-primary']);
?>
<?php
echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->transport_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
</p>
<?php
echo DetailView::widget(['model' => $model, 'attributes' => ['transport_id', ['label' => 'Charge city', 'value' => City::findById($model->charge_city_id)], ['label' => 'Discharge city', 'value' => City::findById($model->discharge_city_id)], 'carcase', 'carcase_charge', 'capacity', 'size', 'status_charge', 'charge_start', 'charge_end', 'work_preferences', 'city_rate', 'intercity_rate', 'passage_rate', 'info:text', 'term', 'created_at', 'updated_at']]);
?>
</div>
示例2:
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\User */
/* @var $form ActiveForm */
$this->title = Yii::t('app', 'Profile');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-profile">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<p>
<?php
echo Html::a(Yii::t('app', 'Update'), ['user/update'], ['class' => 'btn btn-primary']);
?>
<?php
echo Html::a(Yii::t('app', 'Change Password'), ['password-change'], ['class' => 'btn btn-primary']);
?>
</p>
<?php
echo DetailView::widget(['model' => $model, 'attributes' => ['status', 'email', 'type_ownership', 'company', 'INN', 'activity', ['label' => 'City', 'value' => City::findById($model->city_id)], 'address', 'surName', 'firstName', 'lastName', 'number', 'skype', 'site', 'created_at']]);
?>
</div>