prod #7
@ -4,7 +4,7 @@ namespace App\Enums;
|
||||
|
||||
enum TypeLesson: string
|
||||
{
|
||||
case Homework = "Домашнее задание";
|
||||
case Homework = "Домашняя работа";
|
||||
case Classwork = "Работа в классе";
|
||||
case TestClass = "Самостоятельная работа";
|
||||
case ExamClass = "Контрольная работа";
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\TypeLesson;
|
||||
use App\Http\Requests\LessonPostRequest;
|
||||
use App\Models\Lesson;
|
||||
use App\Services\ServiceInterface;
|
||||
@ -31,7 +32,9 @@ class LessonController extends Controller
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
return view('lessons.create');
|
||||
return view('lessons.create', [
|
||||
'types' => TypeLesson::cases(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,6 +65,7 @@ class LessonController extends Controller
|
||||
{
|
||||
return view('lessons.edit', [
|
||||
'lesson' => $lesson,
|
||||
'types' => TypeLesson::cases(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ class Lesson extends Model
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'type',
|
||||
'description',
|
||||
'lesson_date',
|
||||
'grade_id',
|
||||
'teacher_id',
|
||||
@ -25,17 +26,17 @@ class Lesson extends Model
|
||||
return $this->hasMany(Score::class);
|
||||
}
|
||||
|
||||
public function grades(): BelongsTo
|
||||
public function grade(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Grade::class);
|
||||
}
|
||||
|
||||
public function teachers(): BelongsTo
|
||||
public function teacher(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Teacher::class);
|
||||
}
|
||||
|
||||
public function subjects(): BelongsTo
|
||||
public function subject(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Subject::class);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ return new class extends Migration
|
||||
Schema::create('lessons', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('description')->nullable();
|
||||
$table->string('type');
|
||||
$table->date('lesson_date');
|
||||
$table->foreignId('grade_id')->constrained('grades')->onDelete('cascade');
|
||||
|
@ -3,6 +3,7 @@
|
||||
use App\Http\Controllers\GradeController;
|
||||
use App\Http\Controllers\GradeSubjectController;
|
||||
use App\Http\Controllers\GradeTeacherController;
|
||||
use App\Http\Controllers\LessonController;
|
||||
use App\Http\Controllers\StudentController;
|
||||
use App\Http\Controllers\SubjectController;
|
||||
use App\Http\Controllers\SubjectTeacherController;
|
||||
@ -18,6 +19,7 @@ Route::resources([
|
||||
'subjects' => SubjectController::class,
|
||||
'students' => StudentController::class,
|
||||
'teachers' => TeacherController::class,
|
||||
'lessons' => LessonController::class,
|
||||
]);
|
||||
|
||||
Route::resource('teachers.subjects', SubjectTeacherController::class)->except('index');
|
||||
|
Loading…
Reference in New Issue
Block a user