Feat: CRUD категорий курсов

 CourseCategoryController (resource)
 CourseCategoryPolicy
 Маршруты: /admin/course-categories
 Blade-шаблоны:
  - index.blade.php (древовидный список)
  - create.blade.php
  - _row.blade.php (partial для дерева)
 Ссылка в сайдбаре
 Вложенность категорий (parent/children)
 Scope tree() для древовидной структуры

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mirivlad
2026-03-26 10:39:14 +08:00
co-authored by Qwen-Coder
parent 3bec82a991
commit dacff2dd1c
9 changed files with 291 additions and 0 deletions
+7
View File
@@ -38,4 +38,11 @@ class CourseCategory extends Model
{
return $this->hasMany(Course::class);
}
public function scopeTree($query)
{
return $query->with(['children', 'children.children'])->withCount('courses')->orderBy('sort_order')->get()->filter(function($cat) {
return is_null($cat->parent_id);
});
}
}