'int', 'total' => 'float', 'storno' => 'float', 'done' => 'bool' ]; protected $dates = [ 'storno_date', 'storno_print' ]; protected $fillable = [ 'booking_id', 'total', 'storno', 'storno_date', 'storno_print', 'binary_data', 'done' ]; public function booking() { return $this->belongsTo(Booking::class); } public function booking_document() { return $this->hasOne(BookingDocument::class, 'booking_storno_id', 'id'); } public function getTotalFormatted() { return Util::_number_format($this->attributes['total']); } public function getTotalRaw() { return $this->attributes['total']; } public function setTotalAttribute($value) { $this->attributes['total'] = Util::_clean_float($value); } public function getStornoFormatted() { return Util::_number_format($this->attributes['storno']); } public function getStornoRaw() { return $this->attributes['storno']; } public function setStornoAttribute($value) { $this->attributes['storno'] = Util::_clean_float($value); } public function getStornoDateFormatted() { return isset($this->attributes['storno_date']) ? Carbon::parse($this->attributes['storno_date'])->format('d.m.Y') : ''; } public function setStornoDateAttribute($value) { if (!$value) { $this->attributes['storno_date'] = null; } else { $this->attributes['storno_date'] = Carbon::parse($value)->format('Y-m-d'); } } public function getStornoPrintFormatted() { return isset($this->attributes['storno_print']) ? Carbon::parse($this->attributes['storno_print'])->format('d.m.Y') : ''; } public function setStornoPrintAttribute($value) { if (!$value) { $this->attributes['storno_print'] = null; } else { $this->attributes['storno_print'] = Carbon::parse($value)->format('Y-m-d'); } } }