- 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.
81 lines
2.0 KiB
PHP
81 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
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
|
|
{
|
|
use HasFactory, SoftDeletes, HasTranslations;
|
|
|
|
protected $table = 'blog_posts';
|
|
|
|
protected $translatable = [
|
|
'title',
|
|
'excerpt',
|
|
'content',
|
|
'meta_title',
|
|
'meta_description',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'blog_category_id',
|
|
'slug',
|
|
'banner',
|
|
'published_at',
|
|
'is_published',
|
|
'translations',
|
|
];
|
|
|
|
protected $casts = [
|
|
'published_at' => 'date',
|
|
'is_published' => 'boolean',
|
|
];
|
|
|
|
protected $appends = [
|
|
'banner_url',
|
|
'content_html',
|
|
];
|
|
|
|
public function bannerUrl(): Attribute
|
|
{
|
|
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);
|
|
}
|
|
|
|
public function scopeDraft(Builder $query)
|
|
{
|
|
return $query->whereNull('published_at');
|
|
}
|
|
|
|
public function category(): BelongsTo
|
|
{
|
|
return $this->belongsTo(BlogCategory::class, 'blog_category_id');
|
|
}
|
|
|
|
public function author(): BelongsTo
|
|
{
|
|
return $this->belongsTo(BlogAuthor::class, 'blog_author_id');
|
|
}
|
|
} |