I'm trying to write my own widget that I would like to put in the vendor/sergalas/header folder
Here is the code:
<?php namespace sergalas\header; use yii\base\Widget; use common\models\Category; use yii\helpers\ArrayHelper; class Menus extends Widget { public $menu; public function init() { parent::init(); $cat=Category::find()->where('tags=0')->all(); $this->menu=ArrayHelper::toArray($cat,[ 'common\models\Category' => [ 'id', 'name_category', ], ]); } public function run() { return 'Hello'; } } Please explain where and what is the error and how to fix it. Or at least where to find the answer?
vendorfolder should not be touched at all. She's managed by Composer. Check out the documentation and follow the example. - Roman Grinyov