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.
25 lines
483 B
25 lines
483 B
5 years ago
|
<?php
|
||
|
namespace App;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
class WmPackage extends Model
|
||
|
{
|
||
|
|
||
|
public function WmItems()
|
||
|
{
|
||
|
return $this->belongsToMany('App\WmItem')->withPivot('quantity','details');
|
||
|
}
|
||
|
|
||
|
public function getDetailsAttribute()
|
||
|
{
|
||
|
return json_decode($this->attributes['details']);
|
||
|
}
|
||
|
|
||
|
public function setDetailsAttribute($value)
|
||
|
{
|
||
|
$this->attributes['details'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
|
||
|
}
|