<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1070233228039175967</id><updated>2024-10-24T13:33:10.380-07:00</updated><category term="yii2"/><category term="Transaction"/><category term="validation"/><category term="validator"/><category term="$command"/><category term="Autocomplete search"/><category term="BETWEEN"/><category term="CActiveDataProvider"/><category term="CDbCriteria"/><category term="CGridView"/><category term="DATE"/><category term="Date range"/><category term="EGMap"/><category term="Invisible/hide rows in CGridView"/><category term="QueryBuilder"/><category term="Submenu"/><category term="Yii file_exists()"/><category term="addBetweenCondition"/><category term="file_exists()"/><category term="google map"/><category term="group by"/><category term="pagination"/><category term="rowCssClassExpression"/><category term="user agent"/><category term="yii"/><category term="yii Submenu"/><title type='text'>Yii help</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>84</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-5640660998444060535</id><published>2017-03-13T05:21:00.001-07:00</published><updated>2017-03-13T05:30:06.849-07:00</updated><title type='text'>Popup in yii2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre&gt;
yii\bootstrap\Modal::begin([
  &#39;id&#39; =&gt; &#39;myModal&#39;,
   &#39;size&#39; =&gt; &#39;modal-lg&#39;,
   &#39;header&#39; =&gt; &#39;&#39;,
   &#39;clientOptions&#39; =&gt; [&#39;backdrop&#39; =&gt; &#39;static&#39;, &#39;keyboard&#39; =&gt; true]
  ]);


 yii\bootstrap\Modal::end();

      Html::a(Yii::t(&#39;app&#39;, &#39; {modelClass}&#39;, [
       &#39;modelClass&#39; =&gt; &#39;Add More Skill&#39;,
       ]), [&#39;my/newskill&#39;], [&#39;class&#39; =&gt; &#39;btn btn-success&#39;,
       &#39;data-toggle&#39;=&gt;&quot;modal&quot;,
       &#39;data-target&#39;=&gt;&quot;#myModal&quot;,
       &#39;data-title&#39;=&gt;&quot;My Skill&quot;,]);

&lt;/pre&gt;

&lt;pre&gt;
$this-&gt;registerJs(&quot;
    $(&#39;#myModal&#39;).on(&#39;show.bs.modal&#39;, function (event) {
        var button = $(event.relatedTarget)
        var modal = $(this)
        var title = button.data(&#39;title&#39;)
        var href = button.attr(&#39;href&#39;)
        modal.find(&#39;.modal-title&#39;).html(title)
        modal.find(&#39;.modal-body&#39;).html(&#39;&lt;i class=\&quot;fa fa-spinner fa-spin\&quot;&gt;&lt;/i&gt;&#39;)
        $.post(href)
            .done(function( data ) {
                modal.find(&#39;.modal-body&#39;).html(data)
            });
        })
&quot;);
&lt;/pre&gt;
&lt;b&gt;In controller&lt;/b&gt;
&lt;pre&gt;
return $this-&gt;renderAjax(&#39;newskill&#39;, [
            &#39;model&#39; =&gt; $model,
            &#39;services&#39; =&gt; $services,
            &#39;subservices&#39; =&gt; $subservices,
            &#39;basicinfo&#39; =&gt; $basicinfo,
        ]);
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/5640660998444060535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2017/03/popup-in-yii2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5640660998444060535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5640660998444060535'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2017/03/popup-in-yii2.html' title='Popup in yii2'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-3353231731681864646</id><published>2017-03-12T04:20:00.000-07:00</published><updated>2017-03-12T04:20:11.129-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>Save multiple textInput Array value using Yii2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b&gt;controller action:&lt;/b&gt;
&lt;pre&gt;

namespace app\controllers;

use Yii;
use yii\base\Model;
use yii\web\Controller;
use app\models\Experienceskills;

    public function actionExperience()
    {
        $settings = Experienceskills::find()-&gt;indexBy(&#39;id&#39;)-&gt;all();
        if (Model::loadMultiple($settings, Yii::$app-&gt;request-&gt;post()) &amp;&amp; Model::validateMultiple($settings)) {
            foreach ($settings as $setting) {
                $setting-&gt;save(false);
            }
            Yii::$app-&gt;session-&gt;setFlash(
                &#39;success&#39;,
                Yii::t(
                    &#39;user&#39;,
                    &#39;Your experience have been updated.&#39;
                )
            );
            return $this-&gt;redirect([&#39;profile&#39;]);
        }

        return $this-&gt;render(&#39;updateexp&#39;, [&#39;settings&#39; =&gt; $settings]);
    }

&lt;/pre&gt;
&lt;b&gt;view:&lt;/b&gt;
&lt;pre&gt;

use yii\helpers\Html;
use yii\widgets\ActiveForm;

$form = ActiveForm::begin();

foreach ($settings as $index =&gt; $setting) {
 echo $form-&gt;field($setting, &quot;[$index]skill_id&quot;)-&gt;label(&#39;skill&#39;);
echo $form-&gt;field($setting, &quot;[$index]experience_year&quot;)-&gt;label(&#39;Experience&#39;);
}

ActiveForm::end();

&lt;/pre&gt;

&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/3353231731681864646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2017/03/save-multiple-textinput-array-value.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/3353231731681864646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/3353231731681864646'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2017/03/save-multiple-textinput-array-value.html' title='Save multiple textInput Array value using Yii2'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-5750127752034602257</id><published>2017-03-12T00:08:00.000-08:00</published><updated>2017-03-12T00:08:02.429-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>yii2 Ajax Request Post</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;

&lt;pre&gt;
Html::a($service-&gt;name_en,&#39;#&#39;, [
                         &#39;title&#39; =&gt; &#39;Ajax Title&#39;,
                         &#39;onclick&#39;=&gt;&quot;
                         $.ajax({
                        type     :&#39;POST&#39;,
                        cache    : false,
                        data: {id: $service-&gt;id},
                        url  : &#39;&quot;.Url::to([&#39;site/cattt&#39;]).&quot;&#39;,
                        success  : function(response) {
                                $(&#39;#showw&#39;).html(response);
                        },
                        error: function(){
                          console.log(&#39;failure&#39;);
                        }
                        });return false;&quot;,
                       ])
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/5750127752034602257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2017/03/yii2-ajax-request-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5750127752034602257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5750127752034602257'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2017/03/yii2-ajax-request-post.html' title='yii2 Ajax Request Post'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-7417580176736797354</id><published>2017-01-11T21:31:00.000-08:00</published><updated>2017-01-11T21:31:09.310-08:00</updated><title type='text'>renderPartial In Yii</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre&gt;
$this-&gt;renderPartial(
        &#39;application.views.user.index&#39;,
        array(
            &#39;data&#39;=&gt;&#39;Welcome&#39;,
            &#39;model&#39;=&gt;$model,
        ));

&lt;/pre&gt;
&lt;br /&gt;
&lt;pre&gt;
 $this-&gt;renderPartial(&#39;webroot.themes.eusiajb.views.layouts.tpl_footer&#39;);
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/7417580176736797354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2017/01/renderpartial-in-yii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/7417580176736797354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/7417580176736797354'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2017/01/renderpartial-in-yii.html' title='renderPartial In Yii'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-5317855178012463079</id><published>2017-01-04T20:45:00.002-08:00</published><updated>2017-01-04T20:46:56.388-08:00</updated><title type='text'>Import an .sql file from command line</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

&lt;br /&gt;
&lt;pre&gt;
E:\xampp\mysql\bin&gt;mysql -u root -p jobsbd &lt; &quot;C:\Users\Zenith\Downloads\newjb.sql&quot;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/5317855178012463079/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2017/01/import-sql-file-from-command-line.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5317855178012463079'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5317855178012463079'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2017/01/import-sql-file-from-command-line.html' title='Import an .sql file from command line'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-4269295920234944582</id><published>2016-11-18T07:00:00.003-08:00</published><updated>2016-11-18T07:02:53.695-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="validation"/><category scheme="http://www.blogger.com/atom/ns#" term="validator"/><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>yii2 custom validator multiple attributes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre&gt;
public function rules()
    {
 [[&#39;is_property_owner&#39;, &#39;is_property_renant&#39;], &#39;validateproperty&#39;],

 }

    public  function validateproperty($attribute, $params){

        if(empty($this-&gt;is_property_owner) &amp;&amp; empty($this-&gt;is_property_renant)){
            $this-&gt;addError(&#39;is_property_renant&#39;, &#39;Please select at least one option.&#39;);
        }


    }

&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/4269295920234944582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/11/yii2-custom-validator-multiple_18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/4269295920234944582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/4269295920234944582'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/11/yii2-custom-validator-multiple_18.html' title='yii2 custom validator multiple attributes'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Dhaka, Bangladesh</georss:featurename><georss:point>23.810332 90.412518099999943</georss:point><georss:box>23.577844499999998 90.089794599999948 24.0428195 90.735241599999938</georss:box></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-1873748222826311532</id><published>2016-11-18T07:00:00.002-08:00</published><updated>2016-11-18T07:02:08.152-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="validation"/><category scheme="http://www.blogger.com/atom/ns#" term="validator"/><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>yii2 custom validator multiple attributes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre&gt;
public function rules()
    {
 [[&#39;is_property_owner&#39;, &#39;is_property_renant&#39;], &#39;validateproperty&#39;],

 }

    public  function validateproperty($attribute, $params){

        if(empty($this-&gt;is_property_owner) &amp;&amp; empty($this-&gt;is_property_renant)){
            $this-&gt;addError(&#39;is_property_renant&#39;, &#39;Please select at least one option.&#39;);
        }


    }

&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/1873748222826311532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/11/yii2-custom-validator-multiple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1873748222826311532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1873748222826311532'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/11/yii2-custom-validator-multiple.html' title='yii2 custom validator multiple attributes'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Dhaka, Bangladesh</georss:featurename><georss:point>23.810332 90.412518099999943</georss:point><georss:box>23.577844499999998 90.089794599999948 24.0428195 90.735241599999938</georss:box></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-5078524046367410247</id><published>2016-09-14T23:43:00.003-07:00</published><updated>2016-10-31T12:08:25.408-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Transaction"/><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>Yii2 Transaction</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Transaction: A transaction is used to run a group of operations in single process. When you we run multiple query in single process, It will be used. If you get any problem, It will not complete successfully and also rollback the executed query.
&lt;br /&gt;
&lt;pre&gt;
 $transaction = Yii::$app-&gt;db-&gt;beginTransaction();
            try  {
               if($model-&gt;save()){
                $itemprice-&gt;item_id=$model-&gt;id;
                $itemprice-&gt;price=$model-&gt;price;
                $itemprice-&gt;item_cost=$model-&gt;item_cost;
                $itemprice-&gt;wholesale=$model-&gt;wholesale;
                $itemprice-&gt;taxed=$model-&gt;tax;
                $itemprice-&gt;type=$model-&gt;taxed;
                $itemprice-&gt;save(false);
                if($model-&gt;discount==1){
                    $discount-&gt;amount=$discountamount;
                    $discount-&gt;date_from=$discountdate_from;
                    $discount-&gt;date_to=$discountdate_to;
                    $discount-&gt;item_id=$model-&gt;id;
                    $discount-&gt;type=$discounttype;
                    $discount-&gt;status=1;
                    $discount-&gt;date_from=strtotime($discount-&gt;date_from);
                    $discount-&gt;date_to=strtotime($discount-&gt;date_to);
                    $discount-&gt;save(false);
                }
                $transaction-&gt;commit();
                return $this-&gt;redirect([&#39;view&#39;, &#39;id&#39; =&gt; $model-&gt;id]);
            }
} catch (Exception $e) {
                $transaction-&gt;rollBack();
            }
&lt;/pre&gt;

&lt;b&gt;OR&lt;/b&gt;
&lt;pre&gt;
$transaction = $connection-&gt;beginTransaction();
try {
$user = $connection-&gt;createCommand()-&gt;insert(&#39;user&#39;, [
&#39;name&#39; =&gt; &#39;jibon&#39;,
&#39;email&#39; =&gt; &#39;jibon.bikash@gmail.com&#39;,
])-&gt;execute();
$connection-&gt;createCommand()-&gt;insert(&#39;user_role&#39;, [&#39;role = &quot;admin&quot;,
&#39;user_id&#39;=$user-&gt;id
])-&gt;execute();

$transaction-&gt;commit();

} catch(Exception $e) {
    $transaction-&gt;rollback();
}
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/5078524046367410247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/09/yii2-transaction_86.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5078524046367410247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/5078524046367410247'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/09/yii2-transaction_86.html' title='Yii2 Transaction'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-1948157474839751681</id><published>2016-09-14T23:43:00.002-07:00</published><updated>2016-10-31T12:07:38.623-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Transaction"/><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>Yii2 Transaction</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Transaction: A transaction is used to run a group of operations in single process. When you we run multiple query in single process, It will be used. If you get any problem, It will not complete successfully and also rollback the executed query.
&lt;br /&gt;
&lt;pre&gt;
 $transaction = Yii::$app-&gt;db-&gt;beginTransaction();
            try  {
               if($model-&gt;save()){
                $itemprice-&gt;item_id=$model-&gt;id;
                $itemprice-&gt;price=$model-&gt;price;
                $itemprice-&gt;item_cost=$model-&gt;item_cost;
                $itemprice-&gt;wholesale=$model-&gt;wholesale;
                $itemprice-&gt;taxed=$model-&gt;tax;
                $itemprice-&gt;type=$model-&gt;taxed;
                $itemprice-&gt;save(false);
                if($model-&gt;discount==1){
                    $discount-&gt;amount=$discountamount;
                    $discount-&gt;date_from=$discountdate_from;
                    $discount-&gt;date_to=$discountdate_to;
                    $discount-&gt;item_id=$model-&gt;id;
                    $discount-&gt;type=$discounttype;
                    $discount-&gt;status=1;
                    $discount-&gt;date_from=strtotime($discount-&gt;date_from);
                    $discount-&gt;date_to=strtotime($discount-&gt;date_to);
                    $discount-&gt;save(false);
                }
                $transaction-&gt;commit();
                return $this-&gt;redirect([&#39;view&#39;, &#39;id&#39; =&gt; $model-&gt;id]);
            }
} catch (Exception $e) {
                $transaction-&gt;rollBack();
            }
&lt;/pre&gt;

&lt;b&gt;OR&lt;/b&gt;
&lt;pre&gt;
$transaction = $connection-&gt;beginTransaction();
try {
$user = $connection-&gt;createCommand()-&gt;insert(&#39;user&#39;, [
&#39;name&#39; =&gt; &#39;jibon&#39;,
&#39;email&#39; =&gt; &#39;jibon.bikash@gmail.com&#39;,
])-&gt;execute();
$connection-&gt;createCommand()-&gt;insert(&#39;user_role&#39;, [&#39;role = &quot;admin&quot;,
&#39;user_id&#39;=$user-&gt;id
])-&gt;execute();

$transaction-&gt;commit();

} catch(Exception $e) {
    $transaction-&gt;rollback();
}
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/1948157474839751681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/09/yii2-transaction_14.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1948157474839751681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1948157474839751681'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/09/yii2-transaction_14.html' title='Yii2 Transaction'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-6650672668031137065</id><published>2016-09-14T23:43:00.000-07:00</published><updated>2016-09-14T23:43:57.569-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Transaction"/><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>Yii2 Transaction</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Transaction: A transaction is used to run a group of operations in single process. When you we run multiple query in single process, It will be used. If you get any problem, It will not complete successfully and also rollback the executed query.
&lt;br /&gt;
&lt;pre&gt;
 $transaction = Yii::$app-&gt;db-&gt;beginTransaction();
            try  {
               if($model-&gt;save()){
                $itemprice-&gt;item_id=$model-&gt;id;
                $itemprice-&gt;price=$model-&gt;price;
                $itemprice-&gt;item_cost=$model-&gt;item_cost;
                $itemprice-&gt;wholesale=$model-&gt;wholesale;
                $itemprice-&gt;taxed=$model-&gt;tax;
                $itemprice-&gt;type=$model-&gt;taxed;
                $itemprice-&gt;save(false);
                if($model-&gt;discount==1){
                    $discount-&gt;amount=$discountamount;
                    $discount-&gt;date_from=$discountdate_from;
                    $discount-&gt;date_to=$discountdate_to;
                    $discount-&gt;item_id=$model-&gt;id;
                    $discount-&gt;type=$discounttype;
                    $discount-&gt;status=1;
                    $discount-&gt;date_from=strtotime($discount-&gt;date_from);
                    $discount-&gt;date_to=strtotime($discount-&gt;date_to);
                    $discount-&gt;save(false);
                }
                $transaction-&gt;commit();
                return $this-&gt;redirect([&#39;view&#39;, &#39;id&#39; =&gt; $model-&gt;id]);
            }
} catch (Exception $e) {
                $transaction-&gt;rollBack();
            }
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/6650672668031137065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/09/yii2-transaction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/6650672668031137065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/6650672668031137065'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/09/yii2-transaction.html' title='Yii2 Transaction'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-4569458624916587067</id><published>2016-06-11T01:46:00.001-07:00</published><updated>2016-06-11T01:46:24.739-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>Yii2 Show image at a GridView </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;
[
                &#39;attribute&#39; =&gt; &#39;itm_image&#39;,
                &#39;format&#39; =&gt; &#39;image&#39;,
                &#39;value&#39; =&gt; function($data) {
                    if($data-&gt;itm_image){
                        return \Yii::getAlias(&#39;@web/uploads/products/&#39;).$data-&gt;itm_image;
                    }
                    else{
                        return \Yii::getAlias(&#39;@web/uploads/products/no.png&#39;);
                    }
                },
                &#39;contentOptions&#39; =&gt; [&#39;class&#39; =&gt; &#39;item_image_grid img-responsive img-rounded&#39;]
            ],
            [
                &#39;attribute&#39; =&gt; &#39;itm_image&#39;,
                &#39;format&#39; =&gt; &#39;html&#39;,
                &#39;value&#39; =&gt; function ($data) {
                    if($data-&gt;itm_image) {
                        return Html::img(&#39;@web/uploads/products/&#39; . $data-&gt;itm_image,
                            [&#39;width&#39; =&gt; &#39;60px&#39;, &#39;class&#39; =&gt; &#39;img-responsive img-rounded&#39;]);
                    }
                    else{
                        return Html::img(&#39;@web/uploads/products/no.png&#39;,
                            [&#39;width&#39; =&gt; &#39;60px&#39;, &#39;class&#39; =&gt; &#39;img-responsive img-rounded&#39;]);
                    }
                },
            ],
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/4569458624916587067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/06/yii2-show-image-at-gridview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/4569458624916587067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/4569458624916587067'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/06/yii2-show-image-at-gridview.html' title='Yii2 Show image at a GridView '/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-476078949647990112</id><published>2016-06-05T07:52:00.002-07:00</published><updated>2016-06-05T07:52:52.676-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>yii2 file upload </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;

&lt;pre&gt;
if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())){
            $image = UploadedFile::getInstance($model, &#39;image_file&#39;);
            $fileext=time();
            $image-&gt;saveAs(&#39;uploads/&#39; . $fileext.$image-&gt;baseName . &#39;.&#39; . $image-&gt;extension);
            $model-&gt;image_file = $fileext.$image-&gt;baseName.&#39;.&#39;.$image-&gt;extension;
            $model-&gt;save();
            return $this-&gt;redirect([&#39;view&#39;, &#39;id&#39; =&gt; $model-&gt;id]);
        }
        else{
            return $this-&gt;render(&#39;create&#39;, [
                &#39;model&#39; =&gt; $model,
            ]);
        }
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/476078949647990112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/06/yii2-file-upload.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/476078949647990112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/476078949647990112'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/06/yii2-file-upload.html' title='yii2 file upload '/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-773880224867497835</id><published>2016-02-20T11:40:00.002-08:00</published><updated>2016-06-06T04:07:10.224-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>Yii2 change the value in GridView </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;

&lt;pre&gt;
            [
                &#39;attribute&#39; =&gt; &#39;active&#39;,
                &#39;value&#39; =&gt; function ($model) {
                    return $model-&gt;active == 1 ? &#39;Yes&#39; : &#39;No&#39;;
                },
      //        &#39;value&#39; =&gt; function ($data){
       //             return $data-&gt;credit==1 ? &quot;On&quot;: ($data-&gt;credit==2 ? &quot;Pending&quot;: &quot;Off&quot;);
        //        }

                &#39;filter&#39;=&gt;array(&quot;1&quot;=&gt;&quot;Yes&quot;,&quot;0&quot;=&gt;&quot;No&quot;),
          //      &#39;filter&#39; =&gt; Html::activeDropDownList($searchModel, &#39;attribute_name&#39;, ArrayHelper::map(ModelName::find()-&gt;asArray()-&gt;all(), &#39;ID&#39;, &#39;Name&#39;),[&#39;class&#39;=&gt;&#39;form-control&#39;,&#39;prompt&#39; =&gt; &#39;&#39;]),
            ],
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/773880224867497835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-change-value-in-gridview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/773880224867497835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/773880224867497835'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-change-value-in-gridview.html' title='Yii2 change the value in GridView '/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-3028146735863335833</id><published>2016-02-20T11:24:00.004-08:00</published><updated>2016-02-20T11:24:55.233-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>Yii2 static dropDownList</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre&gt;
$form-&gt;field($model, &#39;active&#39;)-&gt;dropDownList([&#39;1&#39; =&gt; &#39;Yes&#39;, &#39;0&#39; =&gt; &#39;No&#39;],[&#39;prompt&#39;=&gt;&#39;&#39;]);
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/3028146735863335833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-static-dropdownlist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/3028146735863335833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/3028146735863335833'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-static-dropdownlist.html' title='Yii2 static dropDownList'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-8101679054437865786</id><published>2016-02-20T11:17:00.001-08:00</published><updated>2016-02-20T11:17:11.159-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="yii2"/><title type='text'>yii2 beforeSave() method </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;

&lt;pre&gt;
    public function beforeSave($insert)
    {
        if (parent::beforeSave($insert)) {
            if ($this-&gt;isNewRecord) {
                $this-&gt;author = \Yii::$app-&gt;user-&gt;identity-&gt;id;
                $this-&gt;create_date = time();
            }
            else {
                $this-&gt;author=\Yii::$app-&gt;user-&gt;identity-&gt;id;
                $this-&gt;update_date=time();

            }

        }

        return true;
    }
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/8101679054437865786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-beforesave-method.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8101679054437865786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8101679054437865786'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-beforesave-method.html' title='yii2 beforeSave() method '/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-125051075304990989</id><published>2016-02-08T22:39:00.000-08:00</published><updated>2016-03-26T00:02:47.093-07:00</updated><title type='text'>Yii2 install</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;pre&gt;
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\HP-14&gt;composer config --global github-oauth.github.com 5c0cab55bca3f6cd
63c4efef------------

C:\Users\HP-14&gt;composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0-dev (72cd6afdfce16f36a9fd786bc1b2f32b851e764f) 2015-12-28 1
7:35:19

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as workin
g directory.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for norma
l output, 2 for more verbose output and 3 for debug

Available commands:
  about           Short information about Composer
  archive         Create an archive of this composer package
  browse          Opens the package&#39;s repository URL or homepage in your browser
.
  clear-cache     Clears composer&#39;s internal package cache.
  clearcache      Clears composer&#39;s internal package cache.
  config          Set config options
  create-project  Create new project from a package into given directory.
  depends         Shows which packages depend on the given package
  diagnose        Diagnoses the system to identify common errors.
  dump-autoload   Dumps the autoloader
  dumpautoload    Dumps the autoloader
  global          Allows running commands in the global composer dir ($COMPOSER_
HOME).
  help            Displays help for a command
  home            Opens the package&#39;s repository URL or homepage in your browser
.
  info            Show information about packages
  init            Creates a basic composer.json file in current directory.
  install         Installs the project dependencies from the composer.lock file
if present, or falls back on the composer.json.
  licenses        Show information about licenses of dependencies
  list            Lists commands
  remove          Removes a package from the require or require-dev
  require         Adds required packages to your composer.json and installs them

  run-script      Run the scripts defined in composer.json.
  search          Search for packages
  self-update     Updates composer.phar to the latest version.
  selfupdate      Updates composer.phar to the latest version.
  show            Show information about packages
  status          Show a list of locally modified packages
  suggests        Show package suggestions
  update          Updates your dependencies to the latest version according to c
omposer.json, and updates the composer.lock file.
  validate        Validates a composer.json and composer.lock

C:\Users\HP-14&gt;cd f:\xampp\htdocs

C:\Users\HP-14&gt;F:

f:\xampp\htdocs&gt;composer create-project --prefer-dist yiisoft/yii2-app-basic
Installing yiisoft/yii2-app-basic (2.0.6)



  [InvalidArgumentException]
  Project directory F:/xampp/htdocs/yii2-app-basic/ is not empty.



create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--r
epository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-plugins] [--no-custom-ins
tallers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-pl
atform-reqs] [--] [&lt;package&gt;] [&lt;directory&gt;] [&lt;version&gt;]



f:\xampp\htdocs&gt;composer create-project --prefer-dist yiisoft/yii2-app-basic
Installing yiisoft/yii2-app-basic (2.0.6)
  - Installing yiisoft/yii2-app-basic (2.0.6)
    Loading from cache

Created project in F:\xampp\htdocs\yii2-app-basic
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing yiisoft/yii2-composer (2.0.4)
    Downloading: 100%

  - Installing ezyang/htmlpurifier (v4.6.0)
    Downloading: 100%

  - Installing bower-asset/jquery (2.1.4)
    Downloading: 100%

  - Installing bower-asset/yii2-pjax (v2.0.5)
    Downloading: 100%

  - Installing bower-asset/punycode (v1.3.2)
    Downloading: 100%

  - Installing bower-asset/jquery.inputmask (3.1.63)
    Downloading: 100%

  - Installing cebe/markdown (1.1.0)
    Downloading: 100%

  - Installing yiisoft/yii2 (2.0.6)
    Downloading: 100%

  - Installing swiftmailer/swiftmailer (v5.4.1)
    Downloading: 100%

  - Installing yiisoft/yii2-swiftmailer (2.0.4)
    Downloading: 100%

  - Installing yiisoft/yii2-codeception (2.0.4)
    Downloading: 100%

  - Installing bower-asset/bootstrap (v3.3.5)
    Downloading: 100%

  - Installing yiisoft/yii2-bootstrap (2.0.5)
    Downloading: 100%

  - Installing yiisoft/yii2-debug (2.0.5)
    Downloading: 100%

  - Installing bower-asset/typeahead.js (v0.10.5)
    Downloading: 100%

  - Installing phpspec/php-diff (v1.0.2)
    Downloading: 100%

  - Installing yiisoft/yii2-gii (2.0.4)
    Downloading: 100%

  - Installing fzaninotto/faker (v1.5.0)
    Downloading: 100%

  - Installing yiisoft/yii2-faker (2.0.3)
    Downloading: 100%

fzaninotto/faker suggests installing ext-intl (*)
Writing lock file
Generating autoload files
&gt; yii\composer\Installer::postCreateProject
chmod(&#39;runtime&#39;, 0777)...done.
chmod(&#39;web/assets&#39;, 0777)...done.
chmod(&#39;yii&#39;, 0755)...done.

f:\xampp\htdocs&gt;composer create-project --prefer-dist yiisoft/yii2-app-advanced
Installing yiisoft/yii2-app-advanced (2.0.6)
  - Installing yiisoft/yii2-app-advanced (2.0.6)
    Downloading: 100%

Created project in F:\xampp\htdocs\yii2-app-advanced
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing yiisoft/yii2-composer (2.0.4)
    Loading from cache

  - Installing ezyang/htmlpurifier (v4.6.0)
    Loading from cache

  - Installing cebe/markdown (1.1.0)
    Loading from cache

  - Installing bower-asset/jquery (2.1.4)
    Loading from cache

  - Installing bower-asset/jquery.inputmask (3.1.63)
    Loading from cache

  - Installing bower-asset/punycode (v1.3.2)
    Loading from cache

  - Installing bower-asset/yii2-pjax (v2.0.5)
    Loading from cache

  - Installing yiisoft/yii2 (2.0.6)
    Loading from cache

  - Installing swiftmailer/swiftmailer (v5.4.1)
    Loading from cache

  - Installing yiisoft/yii2-swiftmailer (2.0.4)
    Loading from cache

  - Installing yiisoft/yii2-codeception (2.0.4)
    Loading from cache

  - Installing bower-asset/bootstrap (v3.3.5)
    Loading from cache

  - Installing yiisoft/yii2-bootstrap (2.0.5)
    Loading from cache

  - Installing yiisoft/yii2-debug (2.0.5)
    Loading from cache

  - Installing bower-asset/typeahead.js (v0.10.5)
    Loading from cache

  - Installing phpspec/php-diff (v1.0.2)
    Loading from cache

  - Installing yiisoft/yii2-gii (2.0.4)
    Loading from cache

  - Installing fzaninotto/faker (v1.5.0)
    Loading from cache

  - Installing yiisoft/yii2-faker (2.0.3)
    Loading from cache

fzaninotto/faker suggests installing ext-intl (*)
Writing lock file
Generating autoload files

f:\xampp\htdocs&gt;cd yii2-app-advanced

f:\xampp\htdocs\yii2-app-advanced&gt;php init
Yii Application Initialization Tool v1.0

Which environment do you want the application to be initialized in?

  [0] Development
  [1] Production

  Your choice [0-1, or &quot;q&quot; to quit] 0

  Initialize the application under &#39;Development&#39; environment? [yes|no] yes

  Start initialization ...

   generate backend/config/main-local.php
   generate backend/config/params-local.php
   generate backend/web/index-test.php
   generate backend/web/index.php
   generate common/config/main-local.php
   generate common/config/params-local.php
   generate console/config/main-local.php
   generate console/config/params-local.php
   generate frontend/config/main-local.php
   generate frontend/config/params-local.php
   generate frontend/web/index-test.php
   generate frontend/web/index.php
   generate yii
   generate cookie validation key in backend/config/main-local.php
   generate cookie validation key in frontend/config/main-local.php
      chmod 0777 backend/runtime
      chmod 0777 backend/web/assets
      chmod 0777 frontend/runtime
      chmod 0777 frontend/web/assets
      chmod 0755 yii
      chmod 0755 tests/codeception/bin/yii

  ... initialization completed.

E:\xampp\htdocs\yii2-app-advanced&gt;yii migrate
Yii Migration Tool (based on Yii v2.0.7)

Creating migration history table &quot;migration&quot;...Done.
Total 1 new migration to be applied:
        m130524_201442_init

Apply the above migration? (yes|no) [no]:yes
*** applying m130524_201442_init
    &gt; create table {{%user}} ... done (time: 0.641s)
*** applied m130524_201442_init (time: 0.788s)


1 migration was applied.

Migrated up successfully.

E:\xampp\htdocs\yii2-app-advanced&gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/125051075304990989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-install.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/125051075304990989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/125051075304990989'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/02/yii2-install.html' title='Yii2 install'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-2665403092747667571</id><published>2016-01-27T01:41:00.000-08:00</published><updated>2016-01-27T01:41:33.911-08:00</updated><title type='text'>Select2 get update value </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
input type hidden value and get value in ID
&lt;pre&gt;

jQuery(function($) {
 //var selectedValues = val(&lt;?php echo $model-&gt;subject;?&gt;).split(&#39;,&#39;);
 var selectedsub = $(&quot;#subjectval&quot;).val().split(&#39;,&#39;);
 var selectedrelevant_law = $(&quot;#relevant_lawval&quot;).val().split(&#39;,&#39;);
 var selectedsectionval = $(&quot;#relevant_sectionval&quot;).val().split(&#39;,&#39;);
 var selectedcourtval = $(&quot;#courtval&quot;).val().split(&#39;,&#39;);
 var selectedjudgeval = $(&quot;#judgeval&quot;).val().split(&#39;,&#39;);
 var selectedadvocateval = $(&quot;#advocateval&quot;).val().split(&#39;,&#39;);
 $(&quot;#subject&quot;).select2().select2(&#39;val&#39;,selectedsub);
 $(&quot;#relevant_law&quot;).select2().select2(&#39;val&#39;,selectedrelevant_law);
 $(&quot;#relevant_section&quot;).select2().select2(&#39;val&#39;,selectedsectionval);
 $(&quot;#court&quot;).select2().select2(&#39;val&#39;,selectedcourtval);
 $(&quot;#judge&quot;).select2().select2(&#39;val&#39;,selectedjudgeval);
 $(&quot;#advocate&quot;).select2().select2(&#39;val&#39;,selectedadvocateval);

});

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/2665403092747667571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/01/select2-get-update-value.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/2665403092747667571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/2665403092747667571'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/01/select2-get-update-value.html' title='Select2 get update value '/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-1822282919172639244</id><published>2016-01-19T22:29:00.004-08:00</published><updated>2016-01-19T22:29:50.796-08:00</updated><title type='text'>Yii countByAttributes or findAllByAttributes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;
    return $count = InstituteClassSummary::model()-&gt;countByAttributes(
    array(
      &#39;zillaid&#39; =&gt; $zilaid,
    ),
    array(
    //  &#39;order&#39; =&gt; &#39;date desc&#39;,
      &#39;group&#39; =&gt; &#39;institude_id&#39;,
    //  &#39;offset&#39; =&gt; 15
    ));
&lt;/pre&gt;

&lt;pre&gt;

$allLogins = InstituteClassSummary::model()-&gt;findAllByAttributes(
array(
    &#39;zillaid&#39; =&gt; Yii::app()-&gt;user-&gt;id,
    &#39;type&#39; =&gt; $zilaid
),
array(
    &#39;order&#39; =&gt; &#39;date desc&#39;,
    &#39;limit&#39; =&gt; 10,
    &#39;offset&#39; =&gt; 15
));

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/1822282919172639244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2016/01/yii-countbyattributes-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1822282919172639244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1822282919172639244'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2016/01/yii-countbyattributes-or.html' title='Yii countByAttributes or findAllByAttributes'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-4044950004386310324</id><published>2015-12-08T22:41:00.005-08:00</published><updated>2015-12-08T22:42:49.079-08:00</updated><title type='text'>Yii validation OnSubmit OnChange</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;
        &#39;enableAjaxValidation&#39;=&gt;true,
 &#39;clientOptions&#39; =&gt; array(
         &#39;validateOnSubmit&#39; =&gt; true,
          &#39;validateOnChange&#39; =&gt; false,
          &#39;validateOnType&#39; =&gt; false,
      //  &#39;errorCssClass&#39; =&gt; &#39;has-error&#39;,
      //  &#39;successCssClass&#39; =&gt; &#39;has-success&#39;,
      //  &#39;afterValidate&#39; =&gt; &#39;js:function(form, data, hasError){}&#39;
        ),
&#39;htmlOptions&#39; =&gt; array(&#39;enctype&#39; =&gt; &#39;multipart/form-data&#39;),
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/4044950004386310324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2015/12/yii-validation-onsubmit-onchange.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/4044950004386310324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/4044950004386310324'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2015/12/yii-validation-onsubmit-onchange.html' title='Yii validation OnSubmit OnChange'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-8800411274776145595</id><published>2015-12-03T02:23:00.003-08:00</published><updated>2016-10-31T12:04:00.128-07:00</updated><title type='text'>Yii MetaTags </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;

Yii::app()-&gt;clientScript-&gt;registerMetaTag(null, null, null,array(&#39;charset&#39;=&gt;&#39;utf-8&#39;));
Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;IE=edge&#39;,null,null,array(&#39;http-equiv&#39;=&gt;&#39;X-UA-Compatible&#39;));
Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;text/html;charset=UTF-8&#39;, null, &#39;content-type&#39;);
Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;width=device-width, initial-scale=1.0&#39;,null,null,array(&#39;name&#39;=&gt;&#39;viewport&#39;));
Yii::app()-&gt;clientScript-&gt;registerMetaTag(Yii::app()-&gt;name, &#39;author&#39;);
Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;Jibon Bikash Roy, jibon.bikash@gmail.com&#39;, &#39;developer&#39;);

&lt;/pre&gt;

&lt;br /&gt;
&lt;pre&gt;
Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;Keyword1, keyword2&#39;, &#39;keywords&#39;);
//Output
&lt;meta name=&quot;keywords&quot; content=&quot;Keyword1, keyword2&quot; /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;pre&gt;

Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;Site Description Details&#39;, &#39;description&#39;);
//Output
&lt;meta name=&quot;description&quot; content=&quot;Site Description Details&quot; /&gt;

&lt;/pre&gt;

&lt;br /&gt;
&lt;pre&gt;

Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;text/html;charset=UTF-8&#39;, null, &#39;content-type&#39;);
//Output
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;

&lt;/pre&gt;


&lt;br /&gt;
&lt;pre&gt;

Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;userid=xyz; expires=Wednesday, 08-Aug-15 23:59:59 GMT;&#39;, null, &#39;cookie&#39;);
//Output
&lt;meta http-equiv=&quot;cookie&quot; content=&quot;userid=xyz; expires=Wednesday, 08-Aug-15 23:59:59 GMT;&quot; /&gt;


&lt;/pre&gt;
&lt;br /&gt;
&lt;pre&gt;

Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;NOINDEX, NOFOLLOW&#39;, &#39;ROBOTS&#39;);
//Output
&lt;meta name=&quot;ROBOTS&quot; content=&quot;NOINDEX, NOFOLLOW&quot; /&gt;
&lt;br /&gt;
Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;INDEX, NOFOLLOW&#39;, &#39;ROBOTS&#39;);
//Output
&lt;meta name=&quot;ROBOTS&quot; content=&quot;INDEX, NOFOLLOW&quot; /&gt; 
&lt;br /&gt;
Yii::app()-&gt;clientScript-&gt;registerMetaTag(&#39;NOINDEX, FOLLOW&#39;, &#39;ROBOTS&#39;);
//Output
&lt;meta name=&quot;ROBOTS&quot; content=&quot;INDEX, NOFOLLOW&quot; /&gt; 
&lt;/pre&gt;
&lt;b&gt;facebook Share Metataq&lt;/b&gt;
&lt;pre&gt;
Yii::app()-&gt;clientScript-&gt;registerMetaTag(Yii::app()-&gt;getBaseUrl(true).&#39;/uploads/workshop/thumbs/&#39;.$model-&gt;banner, null, null, array(&#39;property&#39; =&gt; &quot;og:image&quot;));
    Yii::app()-&gt;clientScript-&gt;registerMetaTag($model-&gt;course_title, null, null, array(&#39;property&#39; =&gt; &quot;og:title&quot;));
    Yii::app()-&gt;clientScript-&gt;registerMetaTag($this-&gt;createAbsoluteUrl(&#39;longCourse/view&#39;,array(&#39;id&#39;=&gt;$model-&gt;id)), null, array(&#39;property&#39; =&gt; &quot;og:url&quot;));
    Yii::app()-&gt;clientScript-&gt;registerMetaTag(Yii::app()-&gt;name, null, null, array(&#39;property&#39; =&gt; &quot;og:site_name&quot;));
    Yii::app()-&gt;clientScript-&gt;registerMetaTag(&quot;website&quot;, null, null, array(&#39;property&#39; =&gt; &quot;og:type&quot;));
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/8800411274776145595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2015/12/yii-metatags.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8800411274776145595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8800411274776145595'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2015/12/yii-metatags.html' title='Yii MetaTags '/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-8155718571204480319</id><published>2015-11-30T23:15:00.000-08:00</published><updated>2015-11-30T23:15:16.986-08:00</updated><title type='text'>Yii addNotInCondition</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;

 $criteria=new CDbCriteria;
 $criteria-&gt;compare(&#39;id&#39;,$this-&gt;id);
 $criteria-&gt;addNotInCondition(&#39;id&#39;,array(1));

 $criteria-&gt;compare(&#39;name&#39;,$this-&gt;name,true);
 return new CActiveDataProvider($this, array(
   &#39;criteria&#39;=&gt;$criteria,
  ));
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/8155718571204480319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-addnotincondition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8155718571204480319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8155718571204480319'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-addnotincondition.html' title='Yii addNotInCondition'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-1496202616875664731</id><published>2015-11-28T01:20:00.002-08:00</published><updated>2015-11-28T01:21:19.311-08:00</updated><title type='text'>Yii How to Add and Upload an Image using editMe</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;

$this-&gt;widget(&#39;ext.editMe.widgets.ExtEditMe&#39;, array(
  &#39;model&#39; =&gt; $model,
   &#39;attribute&#39; =&gt; &#39;content&#39;,
   &#39;ckeConfig&#39;=&gt;array(&#39;enableTabKeyTools&#39;=&gt;true,&#39;enterMode&#39;=&gt;2),
&#39;filebrowserImageBrowseUrl&#39;=&gt;Yii::app()-&gt;baseUrl.&#39;/kcfinder/browse.php?type=files&#39;,
&#39;filebrowserImageUploadUrl&#39;=&gt;Yii::app()-&gt;baseUrl.&#39;/kcfinder/upload.php?type=files&#39;,
&#39;filebrowserBrowseUrl&#39;=&gt;Yii::app()-&gt;baseUrl.&#39;/kcfinder/upload.php?type=files&#39;,
&#39;filebrowserUploadUrl&#39;=&gt;Yii::app()-&gt;baseUrl.&#39;/kcfinder/upload.php?type=files&#39;

));


// Edit configure in kcfinder/conf/config.php
&#39;disabled&#39; =&amp;gt; false,
    &#39;uploadURL&#39; =&amp;gt; &quot;../upload&quot;,


// 



 Dowbload kcfinder from http://kcfinder.sunhater.com/download

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/1496202616875664731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-how-to-add-and-upload-image-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1496202616875664731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1496202616875664731'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-how-to-add-and-upload-image-using.html' title='Yii How to Add and Upload an Image using editMe'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-8444550282725334283</id><published>2015-11-26T10:11:00.002-08:00</published><updated>2015-11-26T10:11:54.156-08:00</updated><title type='text'>Yii Redirect to login for unauthorized  user</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

&lt;pre&gt;

public function accessRules()
 {
  return array(
   
   array(&#39;allow&#39;, // allow admin user to perform &#39;admin&#39; and &#39;delete&#39; actions
    &#39;actions&#39;=&gt;array(&#39;admin&#39;,&#39;delete&#39;,&#39;index&#39;,&#39;view&#39;,&#39;create&#39;,&#39;update&#39;),
    //&#39;users&#39;=&gt;array(&#39;admin&#39;),
      &#39;expression&#39;=&gt;&#39;$user-&gt;isAdmin()&#39;,
   ),
   array(&#39;deny&#39;,  // deny all users
    &#39;users&#39;=&gt;array(&#39;*&#39;),
     &#39;deniedCallback&#39; =&gt; array($this, &#39;redirecting&#39;),
   ),
  );
 }

&lt;br /&gt;
public function redirecting(){
    $this-&gt;redirect(array(&#39;/login&#39;));
}
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/8444550282725334283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-redirect-to-login-for-unauthorized.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8444550282725334283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/8444550282725334283'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-redirect-to-login-for-unauthorized.html' title='Yii Redirect to login for unauthorized  user'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-1392243532718872973</id><published>2015-11-25T10:27:00.000-08:00</published><updated>2015-11-25T10:27:02.831-08:00</updated><title type='text'>yii how to use og meta tag for facebook share</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;

 Yii::app()-&gt;clientScript-&gt;registerMetaTag(Yii::app()-&gt;name,null,null,array(&#39;property&#39;=&gt;&#39;og:site_name&#39;));
 Yii::app()-&gt;clientScript-&gt;registerMetaTag($this-&gt;createAbsoluteUrl(&#39;video/details&#39;,array(&#39;id&#39;=&gt;$video-&gt;id, &#39;slug&#39;=&gt;$video-&gt;slug)),null,null,array(&#39;property&#39;=&gt;&#39;og:url&#39;));
 Yii::app()-&gt;clientScript-&gt;registerMetaTag($video-&gt;tittle,null,null,array(&#39;property&#39;=&gt;&#39;og:title&#39;));
 Yii::app()-&gt;clientScript-&gt;registerMetaTag($video-&gt;details,null,null,array(&#39;property&#39;=&gt;&#39;og:description&#39;));
 Yii::app()-&gt;clientScript-&gt;registerMetaTag(&quot;movie&quot;,null,null,array(&#39;property&#39;=&gt;&#39;og:type&#39;));
              if($video-&gt;screensort):
 $path_image = YiiBase::getPathOfAlias(&#39;webroot&#39;).&#39;/upload/&#39;.$video-&gt;screensort;
 $cropimg= Yii::app()-&gt;easyImage-&gt;thumbSrcOf($path_image, array(&#39;crop&#39; =&gt; array(&#39;width&#39; =&gt; 270, &#39;height&#39; =&gt; 150)));
 Yii::app()-&gt;clientScript-&gt;registerMetaTag($cropimg,null,null,array(&#39;property&#39;=&gt;&#39;og:image&#39;));
 Yii::app()-&gt;clientScript-&gt;registerMetaTag(&quot;270&quot;,null,null,array(&#39;property&#39;=&gt;&#39;og:image:width&#39;));
 Yii::app()-&gt;clientScript-&gt;registerMetaTag(&quot;150&quot;,null,null,array(&#39;property&#39;=&gt;&#39;og:image:height&#39;));
              
  endif;

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/1392243532718872973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-how-to-use-og-meta-tag-for-facebook.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1392243532718872973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/1392243532718872973'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2015/11/yii-how-to-use-og-meta-tag-for-facebook.html' title='yii how to use og meta tag for facebook share'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1070233228039175967.post-6098517823080233265</id><published>2015-10-28T23:09:00.000-07:00</published><updated>2015-10-28T23:09:09.698-07:00</updated><title type='text'>Css Hack for Safari Browser</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;
@media screen and (-webkit-min-device-pixel-ratio:0) {
         /* put webkit CSS here*/
   
   .search-form{
  margin-top: 8px; margin-bottom: 5px; margin-left: -78px !important;  margin-top: -73px; position: absolute;
  }
  // for Safari 
    ::i-block-chrome, .eflat-menu li a {
     padding-right:17px !important;
    }
 
    }
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yiihelp.blogspot.com/feeds/6098517823080233265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yiihelp.blogspot.com/2015/10/css-hack-for-safari-browser.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/6098517823080233265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1070233228039175967/posts/default/6098517823080233265'/><link rel='alternate' type='text/html' href='http://yiihelp.blogspot.com/2015/10/css-hack-for-safari-browser.html' title='Css Hack for Safari Browser'/><author><name>Jibon Bikash Roy</name><uri>http://www.blogger.com/profile/06285299129776024835</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>