Add student achievements module and improve student admin workflows

This commit is contained in:
2026-04-13 06:50:37 +00:00
parent b29c591285
commit fb904f9389
21 changed files with 1111 additions and 180 deletions
+5
View File
@@ -144,4 +144,9 @@ class Student extends Model
{
return $this->hasOne(StudentTransfer::class);
}
public function achievements(): HasMany
{
return $this->hasMany(StudentAchievement::class)->latest('achievement_year')->latest('achievement_date');
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class StudentAchievement extends Model
{
use HasFactory;
protected $fillable = [
'student_id',
'achievement_name',
'category',
'level',
'organizer',
'rank',
'achievement_date',
'achievement_year',
'description',
'certificate_file',
'activity_photo',
];
protected function casts(): array
{
return [
'achievement_date' => 'date',
'achievement_year' => 'integer',
];
}
public function student(): BelongsTo
{
return $this->belongsTo(Student::class);
}
}