'int', 'days_duration' => 'int', 'typ' => 'int', 'discount' => 'float', 'deposit_pro' => 'float', 'price_adult_total' => 'float', 'price_children_total' => 'float', 'active' => 'bool', 'weekdays' => 'array', 'travel_insurance' => 'array', ]; protected $fillable = [ 'name', 'code', 'typ', 'travel_country_id', 'description', 'highlights', 'not_included', 'weekdays', 'days_duration', 'discount', 'deposit_pro', 'price_adult_total', 'price_children_total', 'travel_insurance', 'active' ]; public static $status_type = [ 0 => '-', 4 => '--- ist noch genau zu definieren', 1 => 'individuelles Angebot', 2 => 'Reiseangebot', 3 => 'Reisekonfigurator', ]; public static $days = [ 0 => 'Sonntag', 1 => 'Montag', 2 => 'Dienstag', 3 => 'Mittwoch', 4 => 'Donnerstag', 5 => 'Freitag', 6 => 'Samstag' ]; public function travel_country() { return $this->belongsTo(TravelCountry::class); } public function i_q_travel_program_items() { return $this->hasMany(IQTravelProgramItem::class)->orderBy('pos', 'ASC'); } //price_adult_total public function getPriceAdultTotalAttribute() { return isset($this->attributes['price_adult_total']) ? Util::_number_format($this->attributes['price_adult_total']) : null; } public function setPriceAdultTotalAttribute($value) { $this->attributes['price_adult_total'] = $value ? Util::_clean_float($value) : null; } public function getPriceAdultTotalRaw() { return isset($this->attributes['price_adult_total']) ? $this->attributes['price_adult_total'] : 0; } public function setPriceAdultTotalRaw($value) { return $this->attributes['price_adult_total'] = $value; } //price_children_total public function getPriceChildrenTotalAttribute() { return isset($this->attributes['price_children_total']) ? Util::_number_format($this->attributes['price_children_total']) : null; } public function setPriceChildrenTotalAttribute($value) { $this->attributes['price_children_total'] = $value ? Util::_clean_float($value) : null; } public function getPriceChildrenTotalRaw() { return isset($this->attributes['price_children_total']) ? $this->attributes['price_children_total'] : 0; } public function setPriceChildrenTotalRaw($value) { return $this->attributes['price_children_total'] = $value; } public static function getWeekdaysOptions($weekdays = []){ if($weekdays === null){ $weekdays = []; } $options = range(0, 6); $ret = ''; foreach ($options as $option){ $attr = (in_array($option, $weekdays)) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } }