<?php
namespace App\Models;
use App\Models\Scopes\ParentBranchScope;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CustomerAddress extends Model
{
    protected $fillable = ['customer_id','region','district','ward','street_village','house_number','latitude','longitude'];
    protected function casts(): array { return ['latitude'=>'decimal:7','longitude'=>'decimal:7']; }
    protected static function booted(): void { static::addGlobalScope(new ParentBranchScope('customers', 'customer_id')); }
    public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
}
