Enth\u00e4lt gemischt: Laravel-10-Upgrade + Phase 1 (Contacts-Modul, Duplicats-Commands, Soft-Delete+Merge-Fields) + Phase 2 Code-Umstellungen (inquiry_id, $table='contacts'/'inquiries') + Offers-Modul (Migrationen, Models, offer_id in Booking, offer-Disk in filesystems.php). Phase 2 + Offers werden im folgenden Commit nach dev/backups/phase2-offers-2026-04-17/ verschoben, damit der Workspace auf Phase-1-only (= Test-System-Stand) reduziert ist und direkt auf Live deploybar wird. Tarball-Backup zus\u00e4tzlich unter: ../backups-safety/workspace-pre-phase1-rollback-2026-04-17.tar.gz Made-with: Cursor
127 lines
4.1 KiB
PHP
127 lines
4.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Services\Util;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class BookingServiceItem
|
|
*
|
|
* @property int $id
|
|
* @property int $booking_id
|
|
* @property int $travel_company_id
|
|
* @property float $service_price
|
|
* @property float $service_price_refund
|
|
* @property float $commission
|
|
* @property Carbon $travel_date
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
* @property string $name
|
|
* @property bool $is_commission_locked
|
|
* @property Booking $booking
|
|
* @property TravelCompany $travel_company
|
|
* @package App\Models
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereBookingId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereCommission($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereIsCommissionLocked($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereServicePrice($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereServicePriceRefund($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereTravelCompanyId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereTravelDate($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereUpdatedAt($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class BookingServiceItem extends Model
|
|
{
|
|
protected $connection = 'mysql';
|
|
|
|
protected $table = 'booking_service_item';
|
|
|
|
protected $casts = [
|
|
'booking_id' => 'int',
|
|
'travel_company_id' => 'int',
|
|
'service_price' => 'float',
|
|
'service_price_refund' => 'float',
|
|
'commission' => 'float',
|
|
'is_commission_locked' => 'bool',
|
|
'travel_date' => 'datetime',
|
|
];
|
|
|
|
|
|
protected $fillable = [
|
|
'booking_id',
|
|
'travel_company_id',
|
|
'service_price',
|
|
'service_price_refund',
|
|
'commission',
|
|
'travel_date',
|
|
'name',
|
|
'is_commission_locked'
|
|
];
|
|
|
|
public function booking()
|
|
{
|
|
return $this->belongsTo(Booking::class);
|
|
}
|
|
|
|
public function travel_company()
|
|
{
|
|
return $this->belongsTo(TravelCompany::class);
|
|
}
|
|
|
|
public function setServicePriceAttribute($value)
|
|
{
|
|
$this->attributes['service_price'] = Util::_clean_float($value);
|
|
}
|
|
public function getServicePriceAttribute()
|
|
{
|
|
return Util::_number_format($this->attributes['service_price']);
|
|
}
|
|
public function getServicePriceRaw()
|
|
{
|
|
return $this->attributes['service_price'];
|
|
}
|
|
|
|
public function setCommissionAttribute($value)
|
|
{
|
|
$this->attributes['commission'] = Util::_clean_float($value);
|
|
}
|
|
public function getCommissionAttribute()
|
|
{
|
|
return Util::_number_format($this->attributes['commission']);
|
|
}
|
|
public function getCommissionRaw()
|
|
{
|
|
return $this->attributes['commission'];
|
|
}
|
|
|
|
public function setServicePriceRefundAttribute($value)
|
|
{
|
|
$this->attributes['service_price_refund'] = Util::_clean_float($value);
|
|
}
|
|
public function getServicePriceRefundAttribute()
|
|
{
|
|
return Util::_number_format($this->attributes['service_price_refund']);
|
|
}
|
|
public function getServicePriceRefundRaw()
|
|
{
|
|
return $this->attributes['service_price_refund'];
|
|
}
|
|
|
|
public function setServicePriceRefundRaw($value)
|
|
{
|
|
return $this->attributes['service_price_refund'] = $value;
|
|
}
|
|
}
|