<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Cabang extends Model
{
    use SoftDeletes;

    protected $table = 'cabang';
    protected $fillable = [
        'head_id',
        'region_id',
        'cost_id',
        'code',
        'name',
    ];

    public function head()
    {
        return $this->belongsTo(Admin::class, 'head_id');
    }

    public function region()
    {
        return $this->belongsTo(Region::class, 'region_id');
    }

    public function cost()
    {
        return $this->belongsTo(CostCentre::class, 'cost_id');
    }
}
