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.
31 lines
692 B
31 lines
692 B
5 years ago
|
<?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;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|