- Implemented ClassEnrollmentIndex component for managing class enrollments, including adding and removing students. - Created CourseClassIndex component for managing course classes with CRUD functionality. - Developed columns for course management in createCourseColumns function. - Added CourseIndex component for managing courses with CRUD operations. - Introduced types for class enrollment and course class to enhance type safety. - Updated routes to include endpoints for managing courses, course classes, and enrollments.
27 lines
626 B
PHP
27 lines
626 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
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 Course extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
public function department(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Department::class);
|
|
}
|
|
|
|
public function classes(): HasMany
|
|
{
|
|
return $this->hasMany(CourseClass::class);
|
|
}
|
|
}
|