LMS Этап 1 MVP - Laravel 13
✅ Базовая функциональность: - Аутентификация (вход/выход/регистрация) - Роли и разрешения (Administrator, Manager, Curator, Student) - Панель управления (dashboard) для разных ролей ✅ База данных (23 миграции): - users, organizations, groups, user_groups - course_categories, courses, course_modules - tests, questions, answers, question_matching_pairs - test_attempts, test_responses - course_requests, course_request_items, course_assignments - scorm_data, user_course_progress, logs - permission tables ✅ Модели (15 моделей с отношениями): - User, Organization, Group - CourseCategory, Course, CourseModule - Test, Question, Answer, QuestionMatchingPair - TestAttempt, TestResponse - CourseRequest, CourseRequestItem, CourseAssignment - ScormData, UserCourseProgress, Log ✅ Seeders: - RoleSeeder (роли и разрешения) - UserSeeder (тестовые пользователи) ✅ Контроллеры: - LoginController, RegisterController, DashboardController ✅ Blade-шаблоны: - layouts/app.blade.php - auth/login.blade.php, auth/register.blade.php - dashboard/admin.blade.php, dashboard/curator.blade.php, dashboard/student.blade.php 📦 Пакеты: - Laravel 13 (dev-master) - spatie/laravel-permission - laravel/sanctum 🔧 Инфраструктура: - Nginx конфигурация - PHP 8.4-FPM - MariaDB Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Course extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'category_id',
|
||||
'created_by',
|
||||
'title',
|
||||
'slug',
|
||||
'description',
|
||||
'objectives',
|
||||
'thumbnail',
|
||||
'type',
|
||||
'scorm_package_path',
|
||||
'h5p_package_path',
|
||||
'duration_minutes',
|
||||
'has_certificate',
|
||||
'passing_score',
|
||||
'is_active',
|
||||
'published_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'has_certificate' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
'published_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CourseCategory::class);
|
||||
}
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function modules(): HasMany
|
||||
{
|
||||
return $this->hasMany(CourseModule::class);
|
||||
}
|
||||
|
||||
public function tests(): HasMany
|
||||
{
|
||||
return $this->hasMany(Test::class);
|
||||
}
|
||||
|
||||
public function assignments(): HasMany
|
||||
{
|
||||
return $this->hasMany(CourseAssignment::class);
|
||||
}
|
||||
|
||||
public function scormData(): HasMany
|
||||
{
|
||||
return $this->hasMany(ScormData::class);
|
||||
}
|
||||
|
||||
public function userProgress(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserCourseProgress::class);
|
||||
}
|
||||
|
||||
public function requestItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(CourseRequestItem::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user