From bed748b0aa26f5216d25dcb2c8e8f66740f7c2aa Mon Sep 17 00:00:00 2001 From: Ibrahim Khail Shakil Date: Wed, 20 Dec 2023 10:19:15 +0600 Subject: [PATCH] added description and notes fields in lessons table --- app/Http/Controllers/LessonController.php | 4 ++++ ...2023_11_26_153557_create_lessons_table.php | 2 ++ .../backend/course/lesson/create.blade.php | 20 ++++++++++++++++++ .../backend/course/lesson/edit.blade.php | 20 ++++++++++++++++++ .../views/frontend/watchCourse.blade.php | 21 +++++++++++-------- 5 files changed, 58 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/LessonController.php b/app/Http/Controllers/LessonController.php index 12565bf..125f734 100644 --- a/app/Http/Controllers/LessonController.php +++ b/app/Http/Controllers/LessonController.php @@ -36,6 +36,8 @@ public function store(Request $request) $lesson = new Lesson; $lesson->title = $request->lessonTitle; $lesson->course_id = $request->courseId; + $lesson->description = $request->lessonDescription; + $lesson->notes = $request->lessonNotes; if ($lesson->save()) { $this->notice::success('Data Saved'); @@ -78,6 +80,8 @@ public function update(Request $request, $id) $lesson = Lesson::findOrFail(encryptor('decrypt', $id)); $lesson->title = $request->lessonTitle; $lesson->course_id = $request->courseId; + $lesson->description = $request->lessonDescription; + $lesson->notes = $request->lessonNotes; if ($lesson->save()) { $this->notice::success('Data Saved'); diff --git a/database/migrations/2023_11_26_153557_create_lessons_table.php b/database/migrations/2023_11_26_153557_create_lessons_table.php index 1761bfa..725876d 100644 --- a/database/migrations/2023_11_26_153557_create_lessons_table.php +++ b/database/migrations/2023_11_26_153557_create_lessons_table.php @@ -15,6 +15,8 @@ public function up(): void $table->id(); $table->string('title', 255)->nullable(false); $table->unsignedBigInteger('course_id')->index(); + $table->text('description')->nullable(); + $table->text('notes')->nullable(); $table->timestamps(); $table->softDeletes(); diff --git a/resources/views/backend/course/lesson/create.blade.php b/resources/views/backend/course/lesson/create.blade.php index ec9aaf9..8eb0474 100644 --- a/resources/views/backend/course/lesson/create.blade.php +++ b/resources/views/backend/course/lesson/create.blade.php @@ -65,6 +65,26 @@ {{ $errors->first('courseId') }} @endif +
+
+ + +
+ @if($errors->has('lessonDescription')) + {{ $errors->first('lessonDescription') }} + @endif +
+
+
+ + +
+ @if($errors->has('lessonNotes')) + {{ $errors->first('lessonNotes') }} + @endif +
diff --git a/resources/views/backend/course/lesson/edit.blade.php b/resources/views/backend/course/lesson/edit.blade.php index 855c4e7..efb0854 100644 --- a/resources/views/backend/course/lesson/edit.blade.php +++ b/resources/views/backend/course/lesson/edit.blade.php @@ -68,6 +68,26 @@ {{ $errors->first('courseId') }} @endif
+
+
+ + +
+ @if($errors->has('lessonDescription')) + {{ $errors->first('lessonDescription') }} + @endif +
+
+
+ + +
+ @if($errors->has('lessonNotes')) + {{ $errors->first('lessonNotes') }} + @endif +
diff --git a/resources/views/frontend/watchCourse.blade.php b/resources/views/frontend/watchCourse.blade.php index abdc81b..6c57305 100644 --- a/resources/views/frontend/watchCourse.blade.php +++ b/resources/views/frontend/watchCourse.blade.php @@ -71,7 +71,7 @@
@@ -488,6 +488,8 @@ class="button button-md button--primary float-end">Post
+ + {{-- Index Course Contents --}}