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/WmItem.php

41 lines
762 B

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class WmItem extends Model
{
public function ShoppingCarts()
{
return $this->morphMany('App\ShoppingCart', 'payable');
}
public function WmItemsCategory()
{
return $this->belongsTo('App\WmItemsCategory');
}
public function getDetailsAttribute($value)
{
return json_decode($value);
}
public function setDetailsAttribute($value)
{
$this->attributes['details'] = json_encode($value, JSON_UNESCAPED_UNICODE);
}
public function getPivotDetailsAttribute()
{
return json_decode($this->pivot->details);
}
public function business()
{
return $this->belongsTo('App\Business');
}
}