Build columns while running a query in yii2 -


create columns while running query in yii2

in controller : query :

$query=reports::find()->select(['report type','title','imagefile','id','body'])->where(['like', 'title',''.$test.'' ])->orderby('id desc'); 

i build column type not work.

for see result of alias should add in reports model public var same name value

  class reports extends \yii\db\activerecord   {          public $type;          ..... 

then can access value

    $mymodels->type   

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -