<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CanvasLoading extends Model
{
    // Pastikan 'branch_id' ada di fillable
    protected $fillable = ['branch_id', 'salesman_id', 'date', 'status', 'created_by'];

    // TAMBAHKAN INI:
    public function branch() {
        return $this->belongsTo(\App\Models\Branch::class, 'branch_id');
    }

    public function items() {
        return $this->hasMany(CanvasLoadingItem::class, 'canvas_loading_id');
    }
    
    public function salesman() {
        return $this->belongsTo(\App\Models\Salesman::class, 'salesman_id');
    }
}