- Regel je Angebot auf Abruf: alle Mitglieder, nur freigeschaltete Konten, wer einen Artikel besitzt - Freigaben je Angebot und Konto (offer_releases), nie geloescht, nur entzogen; Pflege im Angebot - Pruefung serverseitig in GrantIssuer::claim; Angebote bei Registrierung bleiben regelfrei - Mitgliederseite Angebote: Neu fuer dich (neue Staende besessener Artikel), Zum Uebernehmen, Shop - Migration 2026_12_01_110000, ADR-56, DEPLOYMENT.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Catalog;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Offer extends Model
|
|
{
|
|
protected $fillable = [
|
|
'name',
|
|
'composition_id',
|
|
'option_label',
|
|
'standalone_bundle',
|
|
'claim_access',
|
|
'claim_requires_article_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'standalone_bundle' => 'boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Altbestand: Programmseite, der eine Option mit mehreren Positionen früher von Hand zugeordnet wurde. Neue Optionen
|
|
* haben genau eine Position; ihre Produktseite ergibt sich aus ihr (Artikel- oder Paketseite) und wird nicht zugeordnet.
|
|
*/
|
|
public function composition(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Composition::class);
|
|
}
|
|
|
|
/** Freigaben einzelner Konten für den Abruf (nur bei Vergabe „auf Abruf“ mit der Regel „freigeschaltete Konten“). */
|
|
public function releases(): HasMany
|
|
{
|
|
return $this->hasMany(OfferRelease::class);
|
|
}
|
|
|
|
/** Bezeichnung der Option auf der Produktseite. */
|
|
public function optionName(): string
|
|
{
|
|
return filled($this->option_label) ? (string) $this->option_label : (string) $this->name;
|
|
}
|
|
|
|
public function versions(): HasMany
|
|
{
|
|
return $this->hasMany(OfferVersion::class);
|
|
}
|
|
}
|