- Created SubmissionService to handle submission logic for assignments. - Added migrations for assignments and submissions tables. - Implemented AssignmentSeeder and SubmissionSeeder for initial data. - Updated DatabaseSeeder to include new seeders. - Enhanced app sidebar to include assignments navigation. - Developed datetime field component for better date and time input. - Created assignment management pages with data tables for assignments and submissions. - Implemented forms for creating and editing assignments and submissions. - Added routes for assignment and submission management in admin panel. - Defined types for assignments and submissions to improve type safety.
32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
use App\Enums\SubmissionStatus;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('submissions', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('assignment_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('student_id')->constrained()->cascadeOnDelete();
|
|
$table->text('notes')->nullable();
|
|
$table->enum('status', array_values(SubmissionStatus::cases()))->nullable()->default(SubmissionStatus::NotSubmitted->value);
|
|
$table->timestamp('submitted_at')->nullable();
|
|
$table->decimal('score', 5, 2)->nullable();
|
|
$table->text('lecturer_feedback')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['assignment_id', 'student_id']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('submissions');
|
|
}
|
|
};
|