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
104 lines
3.1 KiB
PHP
104 lines
3.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use App\User;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class TravelUserBookingFewoNotice
|
|
*
|
|
* @property int $id
|
|
* @property int $travel_user_booking_fewo_id
|
|
* @property int $from_user_id
|
|
* @property int $to_user_id
|
|
* @property string $message
|
|
* @property bool $show
|
|
* @property bool $important
|
|
* @property Carbon $edit_at
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
* @property TravelUserBookingFewo $travel_user_booking_fewo
|
|
* @package App\Models
|
|
* @property-read User $from_user
|
|
* @property-read User|null $to_user
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereEditAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereFromUserId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereImportant($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereMessage($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereShow($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereToUserId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereTravelUserBookingFewoId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|TravelUserBookingFewoNotice whereUpdatedAt($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class TravelUserBookingFewoNotice extends Model
|
|
{
|
|
protected $connection = 'mysql_stern';
|
|
|
|
protected $table = 'travel_user_booking_fewo_notices';
|
|
|
|
protected $casts = [
|
|
'travel_user_booking_fewo_id' => 'int',
|
|
'from_user_id' => 'int',
|
|
'to_user_id' => 'int',
|
|
'show' => 'bool',
|
|
'important' => 'bool',
|
|
'edit_at' => 'datetime',
|
|
];
|
|
|
|
|
|
protected $fillable = [
|
|
'travel_user_booking_fewo_id',
|
|
'from_user_id',
|
|
'to_user_id',
|
|
'message',
|
|
'show',
|
|
'important',
|
|
'edit_at'
|
|
];
|
|
|
|
public function travel_user_booking_fewo()
|
|
{
|
|
return $this->belongsTo(TravelUserBookingFewo::class);
|
|
}
|
|
|
|
public function to_user()
|
|
{
|
|
return $this->belongsTo(User::class, 'to_user_id');
|
|
}
|
|
|
|
public function from_user()
|
|
{
|
|
return $this->belongsTo(User::class, 'from_user_id');
|
|
}
|
|
|
|
public function getName(){
|
|
if($this->from_user){
|
|
if($this->from_user->sf_guard_user){
|
|
return $this->from_user->sf_guard_user->first_name." ".$this->from_user->sf_guard_user->last_name;
|
|
}else{
|
|
$this->from_user->name;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function getSmallerMessage($max = 500){
|
|
|
|
$ret = substr($this->message, 0, $max);
|
|
if(strlen($this->message) > 500){
|
|
$ret .= " ...";
|
|
}
|
|
return $ret;
|
|
}
|
|
}
|