mein-sterntours/app/Models/Page.php
Phase-1-Rollback-Agent e3dc1afd8e WIP: Sicherheitsnetz vor Phase-1-R\u00fcckbau
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
2026-04-17 13:40:31 +00:00

269 lines
9 KiB
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class Page
*
* @property int $id
* @property int|null $owner
* @property string|null $model
* @property int|null $lvl
* @property int $owner_second
* @property int|null $catalog_id
* @property int|null $catalog_index
* @property string|null $slug
* @property int|null $travel_program
* @property int|null $status
* @property int|null $show_in_navi
* @property int|null $order
* @property string|null $title
* @property string|null $title_short
* @property string|null $before_title
* @property string|null $pagetitle
* @property string|null $description
* @property string|null $keywords
* @property string|null $content
* @property string|null $content_new
* @property string|null $buma_destination
* @property int|null $OLD_CatalogID
* @property int|null $OLD_OwnerID
* @property int|null $buma_gjr
* @property Carbon $date
* @property bool $price-tags
* @property string|null $text_right
* @property string|null $keyword
* @property string|null $canonical_url
* @property int|null $country_id
* @property string|null $template
* @property int|null $lft
* @property int|null $rgt
* @property int|null $tree_root
* @property int|null $parent_id
* @property string|null $real_url_path
* @property int|null $travel_guide_content_id
* @property string|null $box_body
* @property string|null $box_image_url
* @property string|null $box_star
* @property string|null $box_discount
* @property string|null $cms_settings
* @property int|null $fewo_lodging
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Page|null $page
* @property TravelCountry|null $travel_country
* @property TravelGuide|null $travel_guide
* @property Collection|Page[] $pages
* @property Collection|Redirect[] $redirects
* @property Collection|TravelCountry[] $travel_countries
* @property Collection|TravelProgram[] $travel_program_content
* @package App\Models
* @property-read Collection<int, Page> $child_pages
* @property-read int|null $child_pages_count
* @property-read int|null $pages_count
* @property-read Page|null $parent_page
* @property-read int|null $travel_countries_count
* @method static \Illuminate\Database\Eloquent\Builder|Page findSimilarSlugs(string $attribute, array $config, string $slug)
* @method static \Illuminate\Database\Eloquent\Builder|Page newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Page newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Page query()
* @method static \Illuminate\Database\Eloquent\Builder|Page whereBeforeTitle($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereBoxBody($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereBoxDiscount($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereBoxImageUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereBoxStar($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereBumaDestination($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereBumaGjr($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCanonicalUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCatalogId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCatalogIndex($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCmsSettings($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereContent($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereContentNew($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCountryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereFewoLodging($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereKeyword($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereKeywords($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereLft($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereLvl($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereModel($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereOLDCatalogID($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereOLDOwnerID($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereOrder($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereOwner($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereOwnerSecond($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page wherePagetitle($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereParentId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page wherePriceTags($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereRealUrlPath($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereRgt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereShowInNavi($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTemplate($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTextRight($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTitle($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTitleShort($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTravelGuideContentId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTravelProgram($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTreeRoot($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
* @mixin \Eloquent
*/
class Page extends Model
{
use Sluggable;
protected $connection = 'mysql_stern';
protected $table = 'page';
protected $casts = [
'owner' => 'int',
'lvl' => 'int',
'owner_second' => 'int',
'catalog_id' => 'int',
'catalog_index' => 'int',
'travel_program' => 'int',
'status' => 'int',
'show_in_navi' => 'int',
'order' => 'int',
'OLD_CatalogID' => 'int',
'OLD_OwnerID' => 'int',
'buma_gjr' => 'int',
'price-tags' => 'bool',
'country_id' => 'int',
'lft' => 'int',
'rgt' => 'int',
'tree_root' => 'int',
'parent_id' => 'int',
'travel_guide_content_id' => 'int',
'fewo_lodging' => 'int',
'date' => 'datetime',
];
protected $fillable = [
'owner',
'model',
'lvl',
'owner_second',
'catalog_id',
'catalog_index',
'slug',
'travel_program',
'status',
'show_in_navi',
'order',
'title',
'title_short',
'before_title',
'pagetitle',
'description',
'keywords',
'content',
'content_new',
'buma_destination',
'OLD_CatalogID',
'OLD_OwnerID',
'buma_gjr',
'date',
'price-tags',
'text_right',
'keyword',
'canonical_url',
'country_id',
'template',
'lft',
'rgt',
'tree_root',
'parent_id',
'real_url_path',
'travel_guide_content_id',
'box_body',
'box_image_url',
'box_star',
'box_discount',
'cms_settings',
'fewo_lodging'
];
public function sluggable(): array
{
return [
'slug' => [
'source' => 'title'
]
];
}
public function page()
{
return $this->belongsTo(Page::class, 'tree_root');
}
public function fewo_lodging()
{
return $this->belongsTo(FewoLodging::class, 'fewo_lodging');
}
public function travel_country()
{
return $this->belongsTo(TravelCountry::class, 'country_id');
}
public function travel_guide()
{
return $this->belongsTo(TravelGuide::class, 'travel_guide_content_id');
}
public function pages()
{
return $this->hasMany(Page::class, 'tree_root');
}
public function redirects()
{
//return $this->hasMany(Redirect::class);
}
public function travel_countries()
{
return $this->hasMany(TravelCountry::class, 'feedback_page_id');
}
public function child_pages()
{
return $this->hasMany(Page::class, 'owner');
}
public function parent_page()
{
return $this->belongsTo(Page::class, 'parent_id');
}
public function travel_program_content()
{
return $this->belongsTo(TravelProgram::class, 'travel_program');
}
public function getContentNew()
{
return $this->content_new ? $this->content_new : $this->content;
}
}