feat: add graduation archive and public document services
This commit is contained in:
@@ -145,6 +145,11 @@ class Student extends Model
|
||||
return $this->hasOne(StudentTransfer::class);
|
||||
}
|
||||
|
||||
public function graduationRecord(): HasOne
|
||||
{
|
||||
return $this->hasOne(StudentGraduation::class);
|
||||
}
|
||||
|
||||
public function achievements(): HasMany
|
||||
{
|
||||
return $this->hasMany(StudentAchievement::class)->latest('achievement_year')->latest('achievement_date');
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class StudentGraduation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'student_number',
|
||||
'nisn',
|
||||
'full_name',
|
||||
'academic_year_id',
|
||||
'department_id',
|
||||
'class_id',
|
||||
'entry_date',
|
||||
'graduation_date',
|
||||
'graduation_note',
|
||||
'skl_file_name',
|
||||
'skl_file_path',
|
||||
'skl_mime_type',
|
||||
'skl_file_size',
|
||||
'ijazah_file_name',
|
||||
'ijazah_file_path',
|
||||
'ijazah_mime_type',
|
||||
'ijazah_file_size',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'entry_date' => 'date',
|
||||
'graduation_date' => 'date',
|
||||
];
|
||||
}
|
||||
|
||||
public function student(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Student::class);
|
||||
}
|
||||
|
||||
public function academicYear(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AcademicYear::class);
|
||||
}
|
||||
|
||||
public function department(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Department::class);
|
||||
}
|
||||
|
||||
public function classRoom(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SchoolClass::class, 'class_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class SyncToken extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'token_hash',
|
||||
'abilities',
|
||||
'created_by',
|
||||
'last_used_at',
|
||||
'revoked_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'abilities' => 'array',
|
||||
'last_used_at' => 'datetime',
|
||||
'revoked_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function getIsRevokedAttribute(): bool
|
||||
{
|
||||
return ! is_null($this->revoked_at);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user