| Current Path : /var/www/html/sprm/backend/models/ |
| Current File : /var/www/html/sprm/backend/models/BanciStatistic.php |
<?php
namespace backend\models;
use Yii;
/**
* This is the model class for table "banci_statistic".
*
* @property int $banci_statistic_id
* @property string $banci_statistic_title
* @property string $banci_statistic_description
* @property string $banci_statistic_counter
* @property string $created_at
* @property string $created_by
* @property string $updated_at
* @property int $updated_by
*/
class BanciStatistic extends \common\models\Dermaga
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'banci_statistic';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['created_at', 'updated_at','banci_statistic_icon_image'], 'safe'],
[['updated_by'], 'integer'],
[['banci_statistic_title'], 'string', 'max' => 250],
[['banci_statistic_description'], 'string', 'max' => 400],
[['banci_statistic_counter'], 'string', 'max' => 20],
[['created_by'], 'string', 'max' => 10],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'banci_statistic_id' => Yii::t('app', 'ID'),
'banci_statistic_title' => Yii::t('app', 'Tajuk'),
'banci_statistic_description' => Yii::t('app', 'Penerangan'),
'banci_statistic_counter' => Yii::t('app', 'Kiraan Statistik'),
'banci_statistic_icon_image' => Yii::t('app', 'Gambar Ikon'),
'created_at' => Yii::t('app', 'Dicipta Pada'),
'created_by' => Yii::t('app', 'Dicipta Oleh'),
'updated_at' => Yii::t('app', 'Updated At'),
'updated_by' => Yii::t('app', 'Updated By'),
];
}
public function upload()
{
if ($this->validate()) {
if ($this->validate()) {
$this->banci_statistic_icon_image->saveAs('uploads/' . $this->banci_statistic_icon_image->baseName . time() . '.' . $this->banci_statistic_icon_image->extension);
/* rewrite url path for uniquenes */
$this->banci_statistic_icon_image = $this->banci_statistic_icon_image->baseName . time() . '.' . $this->banci_statistic_icon_image->extension;
return true;
} else {
return false;
}
return true;
} else {
return false;
}
}
}