コード例 #1
0
 /**
  * Creates a new SystemAuto model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SystemAuto();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 protected function findModel($id)
 {
     if (($model = SystemAuto::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
<?php

use frontend\modules\profile\models\SystemAuto;
use yii\helpers\Url;
$categorys = SystemAuto::getCategoryList();
?>

<div class="row">
    <div class="col-md-12">
        <ul id="list-category">
            <?php 
foreach ($categorys as $id => $name) {
    ?>
            <?php 
    $selectIcon = '';
    $selectClass = '';
    if (isset($_GET['AutoSearch']['category'])) {
        if ($_GET['AutoSearch']['category'] == $id) {
            $selectIcon = '2';
            $selectClass = 'sel-img';
        }
    }
    ?>
                <li>
                    <a href="<?php 
    echo Url::toRoute(['site/index', 'AutoSearch[category]' => $id, 'city_url' => $_GET['city_url']]);
    ?>
" class='<?php 
    echo $selectClass;
    ?>
'>
コード例 #4
0
 protected function findModel($id)
 {
     if (($model = SystemAuto::findOne($id)) !== null) {
         return $model;
     } else {
         $this->setNotFoundHttpException();
     }
 }
コード例 #5
0
ファイル: Account.php プロジェクト: HejVkt/auto.only3.ru
 public function getSystemAutos()
 {
     return $this->hasMany(SystemAuto::className(), ['account_id' => 'id']);
 }