- 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.
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\ClassMethod;
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
#[Guarded(['id'])]
|
|
class CourseClass extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'method' => ClassMethod::class,
|
|
];
|
|
}
|
|
|
|
public function course(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Course::class);
|
|
}
|
|
|
|
public function lecturer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Lecturer::class);
|
|
}
|
|
|
|
public function academicTerm(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AcademicTerm::class);
|
|
}
|
|
|
|
public function enrollments(): HasMany
|
|
{
|
|
return $this->hasMany(ClassEnrollment::class);
|
|
}
|
|
|
|
public function materials(): HasMany
|
|
{
|
|
return $this->hasMany(Material::class);
|
|
}
|
|
|
|
public function assignments(): HasMany
|
|
{
|
|
return $this->hasMany(Assignment::class);
|
|
}
|
|
}
|