fix

parent e255e013
...@@ -34,10 +34,11 @@ use Yii; ...@@ -34,10 +34,11 @@ use Yii;
*/ */
class Reviews extends \common\components\ActiveRecordModel class Reviews extends \common\components\ActiveRecordModel
{ {
public $image;
const PHOTO_FOLDER = '/uploads/reviews/'; const PHOTO_FOLDER = '/uploads/reviews/';
public $image;
public $photo_delete;
private static $rate = [ private static $rate = [
'rate_usability' => [ 'rate_usability' => [
0 => 'Не определено', 0 => 'Не определено',
...@@ -65,7 +66,8 @@ class Reviews extends \common\components\ActiveRecordModel ...@@ -65,7 +66,8 @@ class Reviews extends \common\components\ActiveRecordModel
], ],
]; ];
public static function getSource($type) { public static function getSource($type)
{
return self::$rate[$type]; return self::$rate[$type];
} }
...@@ -100,7 +102,7 @@ class Reviews extends \common\components\ActiveRecordModel ...@@ -100,7 +102,7 @@ class Reviews extends \common\components\ActiveRecordModel
[['image'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'], [['image'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'],
[['text', 'state', 'attendant_products'], 'string'], [['text', 'state', 'attendant_products'], 'string'],
[['admin_id'], 'adminIdValidate'], [['admin_id'], 'adminIdValidate'],
[['date', 'answer', 'good', 'bad', 'date_create', 'notification_date', 'rate_usability', 'rate_loyality', 'rate_profit', 'title', 'order', 'photo', 'state', 'video'], 'safe'], [['date', 'answer', 'good', 'bad', 'date_create', 'notification_date', 'rate_usability', 'rate_loyality', 'rate_profit', 'title', 'order', 'photo', 'state', 'video', 'photo_delete'], 'safe'],
// [['lang'], 'string', 'max' => 2], // [['lang'], 'string', 'max' => 2],
[['title'], 'string', 'max' => 250], [['title'], 'string', 'max' => 250],
[['email', 'video'], 'string', 'max' => 255] [['email', 'video'], 'string', 'max' => 255]
......
...@@ -5,7 +5,7 @@ use yii\helpers\Html; ...@@ -5,7 +5,7 @@ use yii\helpers\Html;
$reviews = Reviews::find() $reviews = Reviews::find()
->where(['state' => 'active']) ->where(['state' => 'active'])
->orderBy('created_at DESC') ->orderBy('created_at DESC')
->limit(2) ->limit(1)
->all(); ->all();
?> ?>
<?php if($reviews) : ?> <?php if($reviews) : ?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment