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
135 lines
3.6 KiB
PHP
135 lines
3.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Arrangement
|
|
*
|
|
* @property int $id
|
|
* @property int $template_id
|
|
* @property Carbon $state
|
|
* @property Carbon $begin
|
|
* @property Carbon $end
|
|
* @property string $type_s
|
|
* @property string $data_s
|
|
* @property int $view_position
|
|
* @property int $booking_id
|
|
* @property int $type_id
|
|
* @property bool $in_pdf
|
|
* @property Booking $booking
|
|
* @property ArrangementTemplate $arrangement_template
|
|
* @package App\Models
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereBegin($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereBookingId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereDataS($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereEnd($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereInPdf($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereState($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereTemplateId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereTypeId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereTypeS($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereViewPosition($value)
|
|
* @property-read \App\Models\ArrangementType|null $arrangement_type
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Arrangement extends Model
|
|
{
|
|
protected $connection = 'mysql';
|
|
|
|
protected $table = 'arrangement';
|
|
public $timestamps = false;
|
|
|
|
protected $casts = [
|
|
'template_id' => 'int',
|
|
'view_position' => 'int',
|
|
'booking_id' => 'int',
|
|
'type_id' => 'int',
|
|
'in_pdf' => 'bool',
|
|
'state' => 'datetime',
|
|
'begin' => 'datetime',
|
|
'end' => 'datetime',
|
|
];
|
|
|
|
|
|
protected $fillable = [
|
|
'template_id',
|
|
'state',
|
|
'begin',
|
|
'end',
|
|
'type_s',
|
|
'data_s',
|
|
'view_position',
|
|
'booking_id',
|
|
'type_id',
|
|
'in_pdf'
|
|
];
|
|
|
|
public function booking()
|
|
{
|
|
return $this->belongsTo(Booking::class);
|
|
}
|
|
|
|
public function arrangement_template()
|
|
{
|
|
return $this->belongsTo(ArrangementTemplate::class, 'template_id');
|
|
}
|
|
|
|
public function arrangement_type()
|
|
{
|
|
return $this->belongsTo(ArrangementType::class, 'type_id');
|
|
}
|
|
|
|
public function getDataAsMap()
|
|
{
|
|
$rawData = $this->attributes['data_s'];
|
|
$data = json_decode('{'. $rawData .'}', true);
|
|
if (is_array($data))
|
|
{
|
|
return $data;
|
|
}
|
|
$entries = preg_split("/[\r\n;]+\s*/", $rawData, -1, PREG_SPLIT_NO_EMPTY);
|
|
$ret = array();
|
|
foreach ($entries as $entry)
|
|
{
|
|
$map = preg_split('/:\s*/', $entry, -1, PREG_SPLIT_NO_EMPTY);
|
|
if (count($map) == 2)
|
|
{
|
|
$ret[$map[0]] = $map[1];
|
|
}
|
|
}
|
|
return $ret;
|
|
}
|
|
|
|
public function getDataS()
|
|
{
|
|
$rawData = $this->attributes['data_s'];
|
|
$data = json_decode('{'. $rawData .'}', true);
|
|
if (is_array($data))
|
|
{
|
|
$str = '';
|
|
$i = 0;
|
|
foreach ($data as $k => $v)
|
|
{
|
|
if (++$i > 0)
|
|
{
|
|
$str .= '';
|
|
}
|
|
$str .= $k .' '. $v;
|
|
}
|
|
return $str;
|
|
}
|
|
return $rawData;
|
|
}
|
|
|
|
}
|