2024-12-11 12:29:55 +07:00
|
|
|
<?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 = [
|
2024-12-24 15:12:24 +07:00
|
|
|
'head_id',
|
2024-12-11 12:29:55 +07:00
|
|
|
'region_id',
|
|
|
|
|
'cost_id',
|
|
|
|
|
'code',
|
|
|
|
|
'name',
|
|
|
|
|
];
|
2024-12-24 15:12:24 +07:00
|
|
|
|
|
|
|
|
public function head()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Admin::class, 'head_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function region()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Region::class, 'region_id');
|
|
|
|
|
}
|
2025-01-08 14:12:45 +07:00
|
|
|
|
|
|
|
|
public function cost()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(CostCentre::class, 'cost_id');
|
|
|
|
|
}
|
2024-12-11 12:29:55 +07:00
|
|
|
}
|