Banner zentral: je Website, Saison und Prioritaet, auch fuer Sonderangebote
Hinweise werden zu Bannern mit Website, Erscheinungsbildern, Prioritaet und optionalem Sonderangebot (Text, Termin und Link aus dem Angebot, sichtbar nur solange es beworben wird). Sonderangebote lassen sich mit einem Klick als Banner zeigen; die Liste nennt das heute sichtbare Banner. Banner-Texte der Erscheinungsbilder werden zu saisonalen Bannern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
791786ed3e
commit
d2b1a853dc
21 files changed
+618
-106
No files matched your search
+25
-3
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\NoticeTone;
|
||||
use App\Models\Concerns\BelongsToAppearances;
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Database\Factories\NoticeFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
@@ -10,15 +11,18 @@
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* A banner shown on the website, optionally limited to a date range.
|
||||
* A banner at the top of the website: for one website or all, optionally only in some appearances (seasons)
|
||||
* and within a date range. It may advertise a special offer – then text, dates and link come from the offer
|
||||
* and the banner only shows while the website advertises that offer. The highest priority wins (BannerResolver).
|
||||
*/
|
||||
#[Fillable(['text', 'tone', 'link_url', 'link_label', 'starts_on', 'ends_on', 'is_active'])]
|
||||
#[Fillable(['site_id', 'special_offer_id', 'appearance_ids', 'priority', 'text', 'tone', 'link_url', 'link_label', 'starts_on', 'ends_on', 'is_active'])]
|
||||
class Notice extends Model
|
||||
{
|
||||
/** @use HasFactory<NoticeFactory> */
|
||||
use BelongsToTenant, HasFactory;
|
||||
use BelongsToAppearances, BelongsToTenant, HasFactory;
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
@@ -29,12 +33,30 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'tone' => NoticeTone::class,
|
||||
'appearance_ids' => 'array',
|
||||
'priority' => 'integer',
|
||||
'starts_on' => 'immutable_date',
|
||||
'ends_on' => 'immutable_date',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Site, $this>
|
||||
*/
|
||||
public function site(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Site::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<SpecialOffer, $this>
|
||||
*/
|
||||
public function specialOffer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SpecialOffer::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Active notices whose date range includes today.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user