<?php

namespace App\Models;

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

class ShippingRate extends Model
{
    use HasFactory;
    protected $table = 'shipping_rates';
    protected $fillable = [
        'name',
        'code',
        'cost',
        'estimation',
    ];

    /**
     * Jika kamu ingin menambahkan logika otomatis, 
     * misalnya format mata uang saat mengambil data cost.
     */
    public function getFormattedCostAttribute()
    {
        return 'Rp ' . number_format($this->cost, 0, ',', '.');
    }
}