siakad-itm/app/Models/Lecturer.php
Yoga Pangestu 2885de2c20 feat: add lecturer and student management pages with CRUD functionality
- Implemented LecturerEdit and LecturerIndex components for managing lecturers.
- Created StudentCreate and StudentEdit components for adding and editing students.
- Developed StudentIndex component for listing students with search and pagination.
- Added department and user types for better type safety.
- Updated routes for lecturers and students, including reset password functionality.
- Removed AppSidebar from dashboard for a cleaner layout.
2026-08-21 14:14:01 +07:00

37 lines
861 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 Lecturer extends Model
{
use HasFactory, SoftDeletes;
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function department(): BelongsTo
{
return $this->belongsTo(Department::class);
}
public function advisees(): HasMany
{
return $this->hasMany(Student::class, 'academic_advisor_id');
}
public function leaderships(): HasMany
{
return $this->hasMany(DepartmentLeadership::class);
}
}