Bezahlte Platzierung gruener, veroeffentlichter PMs ueber die Credit-Wallet: - boosts Tabelle (Zeitraum starts_at/ends_at, days, credits_charged) - BoostService: Gate (nur Published + Green), Preis nach Laufzeit (7/14/30 -> 12/20/35 Credits), Mehrfachkauf verlaengert vom laufenden Ende, Wallet-Belastung referenziert den Boost im Ledger - PressRelease::boosts()/isBoosted()/scopeBoosted() als Basis fuer die Featured-Platzierung (Frontend-Anbindung bleibt der Web-Strecke ueberlassen) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
808 B
PHP
37 lines
808 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Boost;
|
|
use App\Models\PressRelease;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Boost>
|
|
*/
|
|
class BoostFactory extends Factory
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'press_release_id' => PressRelease::factory(),
|
|
'user_id' => User::factory(),
|
|
'days' => 7,
|
|
'credits_charged' => 12,
|
|
'starts_at' => now(),
|
|
'ends_at' => now()->addDays(7),
|
|
];
|
|
}
|
|
|
|
public function expired(): static
|
|
{
|
|
return $this->state(fn (): array => [
|
|
'starts_at' => now()->subDays(14),
|
|
'ends_at' => now()->subDay(),
|
|
]);
|
|
}
|
|
}
|