1. Go to this page and download the library: Download sorokinmedia/yii2-treeview library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sorokinmedia / yii2-treeview example snippets
class CourseLesson extends CourseLessonAR implements TreeViewModelInterface
{
public $level;
public function getChildModels(int $parent_id)
{
return CourseLessonComment::find()
->where(['lesson_id' => $this->id, 'parent_id' => $parent_id])
->orderBy(['created_at' => SORT_DESC])
->all();
}
}
use sorokinmedia\treeview\AbstractTreeView;
class CourseLessonCommentTree extends AbstractTreeView
{
}
class PromoCodeCategory extends AbstractPromoCodeCategory implements TreeViewModelStaticInterface
{
public $level;
public static function getChildModelsStatic(int $parent_id, $filter = null)
{
return static::find()
->where(['parent_id' => $parent_id])
->orderBy(['name' => SORT_ASC])
->all();
}
}
use sorokinmedia\treeview\AbstractTreeView;
class PromoCodeCategoryTree extends AbstractTreeView
{
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.