<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Traits\ModelTimeFormat;

use App\Traits\ModelLogChanging;

class CommodityBarcode extends Model
{
    use ModelLogChanging;

    use ModelTimeFormat;
    protected $fillable=['code','commodity_id','created_at'];

    public function getCodeAttribute($value){
        return str_replace(array("\r\n","\n","\r","\"","&quot;"),' ',$value);
    }
    public function commodity(){
        return $this->belongsTo('App\Commodity','commodity_id','id');
    }
}
