# fluent-cart/1.6.4/app/Models/OrderTaxRate.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 69 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Models/OrderTaxRate.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/app/Models/OrderTaxRate.php
- Modified: 2026-06-11T12:21:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Models/OrderTaxRate.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Models;

/**
 *  Meta Model - DB Model for Meta table
 *
 *  Database Model
 *
 *
 * @version 1.0.0
 */
class OrderTaxRate extends Model
{
    protected $table = 'fct_order_tax_rate';

    protected $primaryKey = 'id';

    protected $guarded = ['id'];

    protected $fillable = [
        'order_id',
        'tax_rate_id',
        'shipping_tax',
        'order_tax',
        'total_tax',
        'meta',
        'filed_at',
    ];

    public function setMetaAttribute($value)
    {
        if ($value) {
            $decoded = \json_encode($value, true);
            if (!($decoded)) {
                $decoded = '[]';
            }
        } else {
            $decoded = '[]';
        }

        $this->attributes['meta'] = $decoded;
    }

    public function getMetaAttribute($value)
    {
        if (!$value) {
            return [];
        }

        return \json_decode($value, true);
    }

    public function order()
    {
        return $this->belongsTo(Order::class, 'order_id', 'id');
    }

    public function tax_rate()
    {
        return $this->belongsTo(TaxRate::class, 'tax_rate_id', 'id');
    }

    public function scopeValidOrder($query)
    {
        return $query->whereHas('order', fn ($o) => $o->whereIn('payment_status', ['paid', 'partially_paid']));
    }
}

```
