<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class IvOrganised extends Model
{
    use HasFactory;

    protected $table = 'iv_organiseds';

    protected $fillable = [
        'faculty_id',
        'start_date',
        'end_date',
        'company_name',
        'company_address',
        'resource_person_name',
        'resource_person_contact_details',
        'target_audience',
        'student_year',
        'number_of_participants',
        'objective',
        'outcomes',
        'department_id',
        'proof'
    ];

    protected $casts = [
        'start_date' => 'datetime',
        'end_date' => 'datetime',
        'number_of_participants' => 'integer',
    ];

    // Relationship with User (Faculty)
    public function user()
    {
        return $this->belongsTo(User::class, 'faculty_id');
    }

    // Relationship with Department
    public function department()
    {
        return $this->belongsTo(Department::class, 'department_id');
    }
}