'int', 'net' => 'float', 'tax_rate' => 'float', 'tax' => 'float', 'total' => 'float', 'paid_out' => 'bool', 'cancellation' => 'bool', 'status' => 'int', 'credit' => 'array', 'user_margins' => 'object' ]; protected $fillable = [ 'auth_user_id', 'net', 'tax_rate', 'tax', 'total', 'date', 'credit', 'user_margins', 'paid_out', 'cancellation', 'status' ]; public function user() { return $this->belongsTo(\App\User::class, 'auth_user_id'); } public function getDateAttribute($value) { if(!$value){ return ""; } return Carbon::parse($value)->format(\Util::formatDateDB()); } public function setDateAttribute( $value ) { $this->attributes['date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL; } public function getDateRaw(){ return isset($this->attributes['date']) ? $this->attributes['date'] : NULL; } public function getFormattedTax() { return formatNumber($this->attributes['tax']); } public function getFormattedNet() { return formatNumber($this->attributes['net']); } public function getFormattedTotal() { return formatNumber($this->attributes['total']); } }