July 27 2016

Yii2 ActiveRecord model use MySQL function

Tagged Under : ,

Yii
To use the MySQL function on Yii2 ActiveRecord Model you to add “\yii\db\Expression” on your script instead of you direct use the “DATE_ADD” function.

Example:
$model->date = new \yii\db\Expression('DATE_ADD(CURRENT_DATE, INTERVAL - 7 DAY)')

July 27 2016

Yii2 an absolute url image src

Tagged Under :

Yii
If you want to set full url or absolute url on Yii2 Html img, you may need to use “Url” helper this class on your page.

use yii\helpers\Url;
The way to use:
Html::img(Url::to('@web/images/logo.png', true));

July 27 2016

Bootstrap glyphicons checkbox

Tagged Under : ,

Because the default HTML chekcbox look not nice, So i decided use Boostrap Glyphicons as the checkbox and also it got provide checked and uncheck glyphicons.

Glyphicons check and uncheck icon: