Answer the question
In order to leave comments, you need to log in
Why is the Class 'sergalas\header\Menus' not found error thrown?
I'm trying to write my own widget that I would like to place 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';
}
}
Answer the question
In order to leave comments, you need to log in
in principle, the issue has already been resolved. I just didn't know if it's advisable to use a separate widgets folder.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question