<?php

namespace Portal\Mileage\Model;

use Illuminate\Database\Eloquent\Model;

class ProjectTeam extends Model
{
    protected $table = 'project_team';
    public $timestamps = true;
    protected $primaryKey = 'id';
    protected $fillable = [
        'fk_project_id', 'pt_project_description', 'role_id',
        'pt_team', 'pt_staff_id', 'pt_project_type', 'pt_project_task_sts',
        'updated_by'
    ];

    public function project()
    {
        return $this->belongsTo(Project::class, 'fk_project_id', 'id');
    }

    // if you want, link to App user model (pt_staff_id commonly stores App user id or employee code)
    public function user()
    {
        return $this->belongsTo(\App\Models\User::class, 'pt_staff_id', 'id');
    }

    public function role()
    {
        return $this->belongsTo(ProjectRole::class, 'role_id');
    }
}
