- 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.
107 lines
2.9 KiB
PHP
107 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
use Filament\Models\Contracts\HasName;
|
|
class User extends Authenticatable implements MustVerifyEmail, HasName
|
|
{
|
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
|
use HasApiTokens, HasFactory, Notifiable;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'email',
|
|
'name',
|
|
'password',
|
|
'username',
|
|
'preferred_locale',
|
|
'first_name',
|
|
'last_name',
|
|
'address',
|
|
'phone',
|
|
'role',
|
|
'pending_purchase',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for serialization.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
'pending_purchase' => 'boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Retrieve the user by the given credentials.
|
|
*/
|
|
public function retrieveByCredentials(array $credentials)
|
|
{
|
|
if ($this->getProvider()->hasTable($this->getTable())) {
|
|
return $this->newModelQuery()
|
|
->where(function ($query) use ($credentials) {
|
|
// Handle 'login' field for email or username
|
|
if (isset($credentials['login'])) {
|
|
$login = $credentials['login'];
|
|
$query->where('email', $login)
|
|
->orWhere('username', $login);
|
|
} else {
|
|
foreach ($this->getAuthIdentifiers() as $key => $value) {
|
|
$query->where($key, $value);
|
|
}
|
|
}
|
|
})
|
|
->first();
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
protected function fullName(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
get: fn () => trim(($this->first_name ?? '') . ' ' . ($this->last_name ?? '')) ?: $this->name,
|
|
);
|
|
}
|
|
|
|
public function getFilamentName(): string
|
|
{
|
|
if ($this->first_name && $this->last_name) {
|
|
return trim($this->first_name . ' ' . $this->last_name);
|
|
}
|
|
return $this->username ?? $this->email ?? 'Unnamed User';
|
|
}
|
|
|
|
public function tenant(): HasOne
|
|
{
|
|
return $this->hasOne(Tenant::class);
|
|
}
|
|
}
|