|
@@ -4,6 +4,9 @@
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
+use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
+use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @property int $id
|
|
* @property int $id
|
|
@@ -31,7 +34,7 @@
|
|
|
*/
|
|
*/
|
|
|
class SchoolClass extends Model
|
|
class SchoolClass extends Model
|
|
|
{
|
|
{
|
|
|
- use HasFactory;
|
|
|
|
|
|
|
+ use HasFactory, SoftDeletes;
|
|
|
|
|
|
|
|
protected $table = 'classes';
|
|
protected $table = 'classes';
|
|
|
|
|
|
|
@@ -40,17 +43,26 @@ class SchoolClass extends Model
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
protected $casts = [
|
|
protected $casts = [
|
|
|
- 'created_at' => 'datetime',
|
|
|
|
|
- 'updated_at' => 'datetime',
|
|
|
|
|
- // Add your casts here (e.g., 'is_active' => 'boolean')
|
|
|
|
|
|
|
+ 'date_time_start' => 'datetime',
|
|
|
|
|
+ 'date_time_end' => 'datetime',
|
|
|
|
|
+ 'created_at' => 'datetime',
|
|
|
|
|
+ 'updated_at' => 'datetime',
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
// Relationships
|
|
// Relationships
|
|
|
|
|
|
|
|
- // Business Logic Methods
|
|
|
|
|
|
|
+ public function unit(): BelongsTo
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->belongsTo(Unit::class);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // Custom Finders
|
|
|
|
|
-
|
|
|
|
|
- // Query Scopes
|
|
|
|
|
|
|
+ public function packageUnit(): BelongsTo
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->belongsTo(ClassPackageUnit::class, 'class_package_unit_id');
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ public function attendances(): HasMany
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->hasMany(ClassAttendance::class, 'class_id');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|