- Implement OfferOptionAdminTest to validate offer option management, including price display, activation, and cancellation. - Create OrganizationPurchaseTest to ensure correct handling of organization purchases, including access control and order processing. - Add ShopProductPageTest to verify shop product listings, search functionality, and product page details. - Introduce BuildsShop trait for seeding test data related to shop functionality. - Implement MoneyTest to validate money parsing and formatting, ensuring correct handling of euro amounts.
34 lines
831 B
PHP
34 lines
831 B
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',
|
|
];
|
|
|
|
/** Komposition, deren öffentliche Seite die Produktseite dieser Lizenzoption ist. */
|
|
public function composition(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Composition::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);
|
|
}
|
|
}
|