<?php

namespace App\Models;

use App\Models\WorkerRequest; 
use App\Models\WorkAreas; 

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

class WorkerRequestWorkArea extends Model
{
   //** Traits */
    use HasFactory;

	//** Variables */

	/**
	 * Manually Define Table Name.  
	 * 
	 * @var string 
	 */
    protected $table = 'worker_request_work_areas';

	/**
	 * Define Relationships that must always be loaded. 
	 * 
	 * @var array 
	 */
	protected $with = 
	[
		//...
	];

	/**
	 * Define attributes that are mass assignable. 
	 * 
	 * @var array 
	 */
    protected $fillable = 
	[
        'worker_request_id', 
        'work_area_id'
    ];

	/**
	 * Define attributes that should be hidden for arrays. 
	 * 
	 * @var array 
	 */
    protected $hidden = 
	[
		//...
    ];

	//** Accessors & Mutators */

    //...

	//** belongsTo, belongsToMany, hasOne, hasMany relationships */ 

    /**
	 * Fetch workerRequest belongsTo relationship 
	 * 
	 * // @return ? 
	 */
    public function workerRequest ()  // : ? 
    {
        return $this->belongsTo(
            related   : WorkerRequest::class,
			foreignKey: "worker_request_id",
			ownerKey  : "id"
		);
    }
    
    /**
	 * Fetch workerRequest belongsTo relationship 
	 * 
	 * // @return ? 
	 */
    public function workArea()  // : ? 
    {
        return $this->belongsTo(
            related   : WorkAreas::class,
			foreignKey: "work_area_id",
			ownerKey  : "id"
		);
    }
}
