<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class JobPosting extends Model
{
    protected $fillable = ['title', 'department_id', 'employment_type', 'location', 'description', 'requirements', 'status', 'closing_date', 'created_by'];
    protected function casts(): array { return ['closing_date' => 'date']; }
    public function department(){ return $this->belongsTo(Department::class); }
    public function applications(){ return $this->hasMany(JobApplication::class); }
    public function creator(){ return $this->belongsTo(User::class, 'created_by'); }
}
