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
79 lines
2.1 KiB
PHP
79 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
/**
|
|
* App\Models\Account
|
|
*
|
|
* @property-read \App\Models\Country $company_country
|
|
* @property-read \App\Models\Country $company_pre_phone
|
|
* @property-read \App\Models\Country $country
|
|
* @property-read mixed $company
|
|
* @property-read \App\Models\Country $pre_mobil
|
|
* @property-read \App\Models\Country $pre_phone
|
|
* @property-read \App\User $user
|
|
* @method static bool|null forceDelete()
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account onlyTrashed()
|
|
* @method static bool|null restore()
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withTrashed()
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withoutTrashed()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account query()
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Account extends Model
|
|
{
|
|
protected $table = 'accounts';
|
|
|
|
|
|
use SoftDeletes;
|
|
protected $casts = [
|
|
'deleted_at' => 'datetime',
|
|
];
|
|
|
|
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo('App\User');
|
|
}
|
|
|
|
|
|
public function company_country()
|
|
{
|
|
return $this->belongsTo('App\Models\Country', 'company_country_id');
|
|
}
|
|
|
|
public function country()
|
|
{
|
|
return $this->belongsTo('App\Models\Country', 'country_id');
|
|
}
|
|
|
|
public function company_pre_phone()
|
|
{
|
|
return $this->belongsTo('App\Models\Country', 'company_pre_phone_id');
|
|
}
|
|
|
|
public function pre_phone()
|
|
{
|
|
return $this->belongsTo('App\Models\Country', 'pre_phone_id');
|
|
}
|
|
|
|
public function pre_mobil()
|
|
{
|
|
return $this->belongsTo('App\Models\Country', 'pre_mobil_id');
|
|
}
|
|
|
|
public function getCompanyAttribute(){
|
|
|
|
if(empty($this->attributes['company']) && @$this->attributes['company'] !== 0){
|
|
return 1;
|
|
}
|
|
return $this->attributes['company'];
|
|
}
|
|
}
|