Change 10.2019
This commit is contained in:
parent
7fbac395a9
commit
8f29c15a2b
6 changed files with 27 additions and 277 deletions
|
|
@ -163,10 +163,6 @@ class Booking extends Model
|
|||
|
||||
}
|
||||
|
||||
public function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
|
@ -140,10 +141,7 @@ class BookingDraftItem extends Model
|
|||
return ['adult'=>$adult, 'children'=>$children];
|
||||
}
|
||||
|
||||
public function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
}
|
||||
|
||||
|
||||
public function getStartDateAttribute(){
|
||||
return isset($this->attributes['start_date']) ? Carbon::parse($this->attributes['start_date'])->format("d.m.Y") : '';
|
||||
}
|
||||
|
|
@ -170,8 +168,7 @@ class BookingDraftItem extends Model
|
|||
//price_adult
|
||||
public function setPriceAdultAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price_adult'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_adult'] = Util::_clean_float($value);
|
||||
}
|
||||
public function getPriceAdultAttribute()
|
||||
{
|
||||
|
|
@ -190,8 +187,7 @@ class BookingDraftItem extends Model
|
|||
//price_children
|
||||
public function setPriceChildrenAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price_children'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_children'] = Util::_clean_float($value);
|
||||
}
|
||||
public function getPriceChildrenAttribute()
|
||||
{
|
||||
|
|
@ -210,8 +206,7 @@ class BookingDraftItem extends Model
|
|||
//price
|
||||
public function setPriceAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price'] = Util::_clean_float($value);
|
||||
}
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -72,14 +73,9 @@ class DraftItem extends Model
|
|||
}
|
||||
|
||||
|
||||
public function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
}
|
||||
|
||||
public function setPriceAdultAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price_adult'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_adult'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
public function getPriceAdultAttribute()
|
||||
|
|
@ -95,8 +91,7 @@ class DraftItem extends Model
|
|||
|
||||
public function setPriceChildrenAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price_children'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_children'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
public function getPriceChildrenAttribute()
|
||||
|
|
@ -112,8 +107,7 @@ class DraftItem extends Model
|
|||
|
||||
public function setPriceAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
|
|
|
|||
|
|
@ -304,8 +304,7 @@ class TravelUserBookingFewo extends Model
|
|||
//price_travel
|
||||
public function setPriceTravelAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_travel'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_travel'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
public function getPriceTravelAttribute($value)
|
||||
|
|
@ -322,8 +321,7 @@ class TravelUserBookingFewo extends Model
|
|||
//price_extra
|
||||
public function setPriceExtraAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_extra'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_extra'] = Util::_clean_float($value);
|
||||
}
|
||||
public function getPriceExtraAttribute($value)
|
||||
{
|
||||
|
|
@ -339,8 +337,7 @@ class TravelUserBookingFewo extends Model
|
|||
//price_balance
|
||||
public function setPriceBalanceAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_balance'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_balance'] = Util::_clean_float($value);
|
||||
}
|
||||
public function getPriceBalanceAttribute($value)
|
||||
{
|
||||
|
|
@ -356,8 +353,7 @@ class TravelUserBookingFewo extends Model
|
|||
//price_travel_total
|
||||
public function setPriceTravelTotalAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_travel_total'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_travel_total'] = Util::_clean_float($value);
|
||||
}
|
||||
public function getPriceTravelTotalAttribute($value)
|
||||
{
|
||||
|
|
@ -377,8 +373,7 @@ class TravelUserBookingFewo extends Model
|
|||
//price_deposit
|
||||
public function setPriceDepositAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_deposit'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_deposit'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
public function getPriceDepositAttribute($value)
|
||||
|
|
@ -395,8 +390,7 @@ class TravelUserBookingFewo extends Model
|
|||
//price_service
|
||||
public function setPriceServiceAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_service'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_service'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
public function getPriceServiceAttribute($value)
|
||||
|
|
@ -414,8 +408,7 @@ class TravelUserBookingFewo extends Model
|
|||
//price_total
|
||||
public function setPriceTotalAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_total'] = floatval(str_replace(',', '.', $value));
|
||||
$this->attributes['price_total'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
public function getPriceTotalAttribute($value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue