- Tenant-Admin-PWA: Neues /event-admin/welcome Onboarding mit WelcomeHero, Packages-, Order-Summary- und Event-Setup-Pages, Zustandsspeicher, Routing-Guard und Dashboard-CTA für Erstnutzer; Filament-/admin-Login via Custom-View behoben.
- Brand/Theming: Marketing-Farb- und Typographievariablen in `resources/css/app.css` eingeführt, AdminLayout, Dashboardkarten und Onboarding-Komponenten entsprechend angepasst; Dokumentation (`docs/todo/tenant-admin-onboarding-fusion.md`, `docs/changes/...`) aktualisiert. - Checkout & Payments: Checkout-, PayPal-Controller und Tests für integrierte Stripe/PayPal-Flows sowie Paket-Billing-Abläufe überarbeitet; neue PayPal SDK-Factory und Admin-API-Helper (`resources/js/admin/api.ts`) schaffen Grundlage für Billing/Members/Tasks-Seiten. - DX & Tests: Neue Playwright/E2E-Struktur (docs/testing/e2e.md, `tests/e2e/tenant-onboarding-flow.test.ts`, Utilities), E2E-Tenant-Seeder und zusätzliche Übersetzungen/Factories zur Unterstützung der neuen Flows. - Marketing-Kommunikation: Automatische Kontakt-Bestätigungsmail (`ContactConfirmation` + Blade-Template) implementiert; Guest-PWA unter `/event` erreichbar. - Nebensitzung: Blogsystem gefixt und umfassenden BlogPostSeeder für Beispielinhalte angelegt.
This commit is contained in:
22
app/Models/BlogAuthor.php
Normal file
22
app/Models/BlogAuthor.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BlogAuthor extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'blog_authors';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'photo',
|
||||
'bio',
|
||||
'github_handle',
|
||||
'twitter_handle',
|
||||
];
|
||||
}
|
||||
@@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
|
||||
class BlogPost extends Model
|
||||
{
|
||||
@@ -41,6 +42,7 @@ class BlogPost extends Model
|
||||
|
||||
protected $appends = [
|
||||
'banner_url',
|
||||
'content_html',
|
||||
];
|
||||
|
||||
public function bannerUrl(): Attribute
|
||||
@@ -48,6 +50,15 @@ class BlogPost extends Model
|
||||
return Attribute::get(fn () => $this->banner ? asset(Storage::url($this->banner)) : '');
|
||||
}
|
||||
|
||||
public function contentHtml(): Attribute
|
||||
{
|
||||
return Attribute::get(function () {
|
||||
$markdown = $this->getTranslation('content', app()->getLocale());
|
||||
$converter = new CommonMarkConverter();
|
||||
return $converter->convert($markdown);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopePublished(Builder $query)
|
||||
{
|
||||
return $query->whereNotNull('published_at')->where('is_published', true);
|
||||
@@ -62,4 +73,9 @@ class BlogPost extends Model
|
||||
{
|
||||
return $this->belongsTo(BlogCategory::class, 'blog_category_id');
|
||||
}
|
||||
|
||||
public function author(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(BlogAuthor::class, 'blog_author_id');
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\EventCreditsLedger;
|
||||
|
||||
class Tenant extends Model
|
||||
{
|
||||
@@ -24,6 +25,7 @@ class Tenant extends Model
|
||||
'last_activity_at' => 'datetime',
|
||||
'total_revenue' => 'decimal:2',
|
||||
'settings_updated_at' => 'datetime',
|
||||
'subscription_expires_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function events(): HasMany
|
||||
@@ -60,7 +62,7 @@ class Tenant extends Model
|
||||
|
||||
public function canCreateEvent(): bool
|
||||
{
|
||||
$package = $this->activeResellerPackage();
|
||||
$package = $this->activeResellerPackage()->first();
|
||||
if (!$package) {
|
||||
return false;
|
||||
}
|
||||
@@ -70,7 +72,7 @@ class Tenant extends Model
|
||||
|
||||
public function incrementUsedEvents(int $amount = 1): bool
|
||||
{
|
||||
$package = $this->activeResellerPackage();
|
||||
$package = $this->activeResellerPackage()->first();
|
||||
if (!$package) {
|
||||
return false;
|
||||
}
|
||||
@@ -89,10 +91,52 @@ class Tenant extends Model
|
||||
$this->attributes['settings'] = json_encode($value ?? []);
|
||||
}
|
||||
|
||||
public function incrementCredits(int $amount, string $reason = 'manual', ?string $note = null, ?int $purchaseId = null): bool
|
||||
{
|
||||
if ($amount <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$balance = (int) ($this->event_credits_balance ?? 0) + $amount;
|
||||
$this->forceFill(['event_credits_balance' => $balance])->save();
|
||||
|
||||
EventCreditsLedger::create([
|
||||
'tenant_id' => $this->id,
|
||||
'delta' => $amount,
|
||||
'reason' => $reason,
|
||||
'related_purchase_id' => $purchaseId,
|
||||
'note' => $note,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function decrementCredits(int $amount, string $reason = 'usage', ?string $note = null, ?int $purchaseId = null): bool
|
||||
{
|
||||
$current = (int) ($this->event_credits_balance ?? 0);
|
||||
|
||||
if ($amount <= 0 || $amount > $current) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$balance = $current - $amount;
|
||||
$this->forceFill(['event_credits_balance' => $balance])->save();
|
||||
|
||||
EventCreditsLedger::create([
|
||||
'tenant_id' => $this->id,
|
||||
'delta' => -$amount,
|
||||
'reason' => $reason,
|
||||
'related_purchase_id' => $purchaseId,
|
||||
'note' => $note,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function activeSubscription(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => $this->activeResellerPackage() !== null,
|
||||
get: fn () => $this->activeResellerPackage()->exists(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class User extends Authenticatable implements MustVerifyEmail, HasName
|
||||
*/
|
||||
protected $fillable = [
|
||||
'email',
|
||||
'name',
|
||||
'password',
|
||||
'username',
|
||||
'preferred_locale',
|
||||
@@ -86,7 +87,7 @@ class User extends Authenticatable implements MustVerifyEmail, HasName
|
||||
protected function fullName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => $this->first_name . ' ' . $this->last_name,
|
||||
get: fn () => trim(($this->first_name ?? '') . ' ' . ($this->last_name ?? '')) ?: $this->name,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user