PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk 1.2.0 All 47 releases
fluent-cart / app / Models / TaxRate.php

TaxRate.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at app/Models/TaxRate.php

57 lines 944 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Models;
4
5 use FluentCart\App\Helpers\AddressHelper;
6
7 /**
8 * Meta Model - DB Model for Meta table
9 *
10 * Database Model
11 *
12 * @package FluentCart\App\Models
13 *
14 * @version 1.0.0
15 */
16 class TaxRate extends Model
17 {
18 protected $table = 'fct_tax_rates';
19
20 public $timestamps = false;
21
22 protected $primaryKey = 'id';
23
24 protected $guarded = [ 'id' ];
25
26 protected $fillable = [
27 'class_id',
28 'country',
29 'state',
30 'postcode',
31 'city',
32 'rate',
33 'name',
34 'group',
35 'priority',
36 'is_compound',
37 'for_shipping',
38 'for_order',
39 'class_id'
40 ];
41
42 protected $appends = ['formatted_state'];
43
44 public function tax_class() {
45 return $this->belongsTo( TaxClass::class, 'class_id', 'id' );
46 }
47
48 public function getFormattedStateAttribute()
49 {
50 if (!empty($this->state)) {
51 return AddressHelper::getStateNameByCode($this->state, $this->country);
52 }
53 return '';
54 }
55
56 }
57