This commit is contained in:
Kevin Adametz 2020-05-06 15:52:59 +02:00
parent 68b9d1ff88
commit b9c26d06d0
75 changed files with 2143 additions and 818 deletions

View file

@ -6,6 +6,7 @@
namespace App\Models;
use App\Services\Util;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
@ -44,15 +45,19 @@ class TravelCompany extends Model
protected $casts = [
'percentage' => 'float',
'is_allowed_edit_commission' => 'bool',
'is_inhouse' => 'bool'
];
'is_inhouse' => 'bool',
'active' => 'bool',
'contact_emails' => 'array'
];
protected $fillable = [
'name',
'percentage',
'is_allowed_edit_commission',
'is_inhouse'
];
'is_inhouse',
'contact_emails',
'active'
];
public function bookings()
{
@ -63,4 +68,19 @@ class TravelCompany extends Model
{
return $this->hasMany(BookingServiceItem::class);
}
public function setPercentageAttribute($value)
{
$this->attributes['percentage'] = Util::_clean_float($value);
}
public function getPercentageAttribute()
{
return Util::_number_format($this->attributes['percentage']);
}
public function getPercentageRaw()
{
return isset($this->attributes['percentage']) ? $this->attributes['percentage'] : 0;
}
}