Change 10.2019
This commit is contained in:
parent
7fbac395a9
commit
8f29c15a2b
6 changed files with 27 additions and 277 deletions
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue