You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
willaengine/app/ShippingRule.php

31 lines
692 B

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ShippingRule extends Model
{
protected $fillable = ['type', 'shipping_group_id', 'shipping_method_id', 'price', 'exceptions'];
public function shipping_group()
{
return $this->belongsTo('App\ShippingGroup');
}
public function getExceptionsAttribute()
{
return json_decode($this->attributes['exceptions']);
}
public function setExceptionsAttribute($value)
{
if ($value !== null) {
$this->attributes['exceptions'] = json_encode($value, JSON_UNESCAPED_UNICODE);
} else {
$this->attributes['exceptions'] = null;
}
}
}