| Total Complexity | 2 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | class Rate extends Model |
||
| 26 | { |
||
| 27 | use Migratable; |
||
| 28 | use SoftDeletes; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * The attributes that should be casted to Carbon dates. |
||
| 32 | * |
||
| 33 | * @var string[] |
||
| 34 | */ |
||
| 35 | protected $dates = [ |
||
| 36 | 'deleted_at', |
||
| 37 | ]; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * The attributes that can be filled. |
||
| 41 | * |
||
| 42 | * @var string[] |
||
| 43 | */ |
||
| 44 | public $fillable = [ |
||
| 45 | 'rate', |
||
| 46 | 'name', |
||
| 47 | 'compound', |
||
| 48 | 'shipping', |
||
| 49 | 'type', |
||
| 50 | ]; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * The attributes that should be casted to native types. |
||
| 54 | * |
||
| 55 | * @var array |
||
| 56 | */ |
||
| 57 | protected $casts = [ |
||
| 58 | 'rate' => 'float', |
||
| 59 | 'name' => 'string', |
||
| 60 | 'compound' => 'boolean', |
||
| 61 | 'shipping' => 'boolean', |
||
| 62 | ]; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Validation rules. |
||
| 66 | * |
||
| 67 | * @var array |
||
| 68 | */ |
||
| 69 | public static $rules = [ |
||
| 70 | 'rate' => 'required', |
||
| 71 | 'name' => 'required', |
||
| 72 | 'type' => 'required', |
||
| 73 | ]; |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Constructor. |
||
| 77 | * |
||
| 78 | * @param array $attributes additional attributes for model initialisation |
||
| 79 | * |
||
| 80 | * @return void |
||
| 81 | */ |
||
| 82 | public function __construct(array $attributes = []) |
||
| 83 | { |
||
| 84 | parent::__construct($attributes); |
||
| 85 | |||
| 86 | $this->setTable(config('pwweb.localisation.table_names.tax.rates')); |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * Accessor for linked Location model. |
||
| 91 | * |
||
| 92 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
| 93 | **/ |
||
| 94 | public function country(): HasMany |
||
| 97 | } |
||
| 98 | } |
||
| 99 |