This commit is contained in:
salam committed 2025-09-25 14:37:34 +02:00
1 parent 5f95289079
commit 60249dffd9
37 files changed
+412 -458

No files matched your search

+32 -86
View File
@@ -7,6 +7,7 @@ use Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber;
use Filament\Auth\Pages\Register as BaseRegister;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Utilities\Get;
@@ -18,6 +19,8 @@ use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
class Register extends BaseRegister
{
public User $user;
public function form(Schema $schema): Schema
{
return $schema
@@ -39,28 +42,35 @@ class Register extends BaseRegister
->description('Mit einem Konto verbinden.')
->schema([
$this->getKontoModusFormComponent(),
/** OLD */
/** BESTEHENDES KONTO */
$this->getKontoFormComponent(),
/** NEU */
Fieldset::make('Rechnungsdaten')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([
$this->getCompanyFormComponent(),
$this->getUIDFormComponent(),
$this->getPLZFormComponent(),
$this->getLocationFormComponent(),
$this->getAdresseFormComponent(),
$this->getCountryFormComponent(),
TextInput::make('company')
->label('Firma')
->required(),
TextInput::make('uid_number')
->label('UID Nummer')
->rules([new VatNumber])
->required(),
Textarea::make('address')
->label('Adresse')
->required(),
TextInput::make('country')
->label('Land')
->default('Österreich')
->required(),
])->columnSpan(4),
Fieldset::make('Kontaktperson')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([
$this->getKontoGenderFormComponent(),
$this->getTitleFormComponent(),
$this->getKontoFirstNameFormComponent(),
$this->getKontoLastNameFormComponent(),
$this->getKontoEmailFormComponent(),
$this->getPhoneFormComponent(),
// $this->getKontoGenderFormComponent(),
// $this->getTitleFormComponent(),
// $this->getNameFormComponent(),
// $this->getKontoEmailFormComponent(),
// $this->getPhoneFormComponent(),
])->columnSpan(4),
]),
@@ -72,7 +82,9 @@ class Register extends BaseRegister
Fieldset::make('Bitte lesen und akzeptieren Sie die allgemeinen Geschäftsbedignungen um die Registrierung abzuschließen.')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([
$this->getABGFormComponent(),
Checkbox::make('agb_akzeptiert')
->label('ABG akzeptieren')
->required(),
]),
View::make('pages.agb'),
@@ -130,7 +142,7 @@ class Register extends BaseRegister
'Um das erstellte Profil zu aktivieren muß der Kontoinhaber die Anmeldung im Programm freischalten',
])
->visible(fn (Get $get): bool => $get('konto') == 'old')
->options(Konto::query()->pluck('konto_company', 'id'))
->options(Konto::query()->pluck('company', 'id'))
->searchable()
->required();
}
@@ -138,17 +150,9 @@ class Register extends BaseRegister
/**
* KONTO NEU
*/
protected function getABGFormComponent(): Checkbox
{
return Checkbox::make('konto_agb_akzeptiert')
->label('ABG akzeptieren')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getTitleFormComponent(): TextInput
{
return TextInput::make('konto_title')
return TextInput::make('title')
->label('Title')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
@@ -156,7 +160,7 @@ class Register extends BaseRegister
protected function getKontoGenderFormComponent(): Select
{
return Select::make('konto_gender')
return Select::make('gender')
->columnSpan(2)
->label('Geschlecht')
->visible(fn (Get $get): bool => $get('konto') == 'new')
@@ -168,25 +172,9 @@ class Register extends BaseRegister
->required();
}
protected function getKontoFirstNameFormComponent(): TextInput
{
return TextInput::make('konto_first_name')
->label('Vorname')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getKontoLastNameFormComponent(): TextInput
{
return TextInput::make('konto_last_name')
->label('Nachname')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getCompanyFormComponent(): TextInput
{
return TextInput::make('konto_company')
return TextInput::make('konto.company')
->label('Firma')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
@@ -194,60 +182,18 @@ class Register extends BaseRegister
protected function getKontoEmailFormComponent(): TextInput
{
return TextInput::make('konto_email')
return TextInput::make('email')
->label('E-Mail')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->unique(table: Konto::class)
->required();
}
protected function getAdresseFormComponent(): TextInput
{
return TextInput::make('konto_address')
->label('Adresse')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getLocationFormComponent(): TextInput
{
return TextInput::make('konto_location')
->label('Ort')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getPLZFormComponent(): TextInput
{
return TextInput::make('konto_plz')
->label('Postleitzahl')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getPhoneFormComponent(): PhoneInput
{
return PhoneInput::make('konto_phone')
return PhoneInput::make('phone')
->label('Telefon')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->defaultCountry('AT');
}
protected function getCountryFormComponent(): TextInput
{
return TextInput::make('konto_country')
->label('Land')
->default('Österreich')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getUIDFormComponent(): TextInput
{
return TextInput::make('konto_uid_number')
->label('UID Nummer')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->rules([new VatNumber])
->required();
}
}
@@ -1,64 +0,0 @@
<?php
namespace App\Filament\Resources\KontoOptions;
use App\Filament\Clusters\Administration\AdministrationCluster;
use App\Filament\Resources\KontoOptions\Pages\CreateKontoOption;
use App\Filament\Resources\KontoOptions\Pages\EditKontoOption;
use App\Filament\Resources\KontoOptions\Pages\ListKontoOptions;
use App\Filament\Resources\KontoOptions\Schemas\KontoOptionForm;
use App\Filament\Resources\KontoOptions\Tables\KontoOptionTable;
use App\Models\KontoOption;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use UnitEnum;
class KontoOptionResource extends Resource
{
protected static ?string $model = KontoOption::class;
protected static ?string $cluster = AdministrationCluster::class;
protected static string|UnitEnum|null $navigationGroup = 'Kunden';
protected static string|BackedEnum|null $navigationIcon = 'lucide-key-square';
protected static ?string $navigationLabel = 'Konto Optionen';
protected static ?string $modelLabel = 'Konto Option';
protected static ?string $pluralModelLabel = 'Konto Optionen';
public static function form(Schema $schema): Schema
{
return KontoOptionForm::configure($schema);
}
public static function table(Table $table): Table
{
return KontoOptionTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListKontoOptions::route('/'),
'create' => CreateKontoOption::route('/create'),
'edit' => EditKontoOption::route('/{record}/edit'),
];
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->count();
}
}
@@ -1,11 +0,0 @@
<?php
namespace App\Filament\Resources\KontoOptions\Pages;
use App\Filament\Resources\KontoOptions\KontoOptionResource;
use Filament\Resources\Pages\CreateRecord;
class CreateKontoOption extends CreateRecord
{
protected static string $resource = KontoOptionResource::class;
}
@@ -1,19 +0,0 @@
<?php
namespace App\Filament\Resources\KontoOptions\Pages;
use App\Filament\Resources\KontoOptions\KontoOptionResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditKontoOption extends EditRecord
{
protected static string $resource = KontoOptionResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -1,19 +0,0 @@
<?php
namespace App\Filament\Resources\KontoOptions\Pages;
use App\Filament\Resources\KontoOptions\KontoOptionResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListKontoOptions extends ListRecords
{
protected static string $resource = KontoOptionResource::class;
protected function getHeaderActions(): array
{
return [
// CreateAction::make(),
];
}
}
@@ -15,37 +15,37 @@ class KontoForm
{
return $schema
->components([
TextInput::make('konto_company')
TextInput::make('company')
->label('Firma')
->required(),
TextInput::make('konto_email')
TextInput::make('email')
->label('E-Mail')
->unique(table: Konto::class)
->required(),
TextInput::make('konto_address')
TextInput::make('address')
->label('Adresse')
->required(),
TextInput::make('konto_location')
TextInput::make('location')
->label('Ort')
->required(),
TextInput::make('konto_plz')
TextInput::make('plz')
->label('Postleitzahl')
->required(),
PhoneInput::make('konto_phone')
PhoneInput::make('phone')
->label('Telefon')
->defaultCountry('AT'),
TextInput::make('konto_country')
TextInput::make('country')
->label('Land')
->default('Österreich')
->required(),
TextInput::make('konto_uid_number')
TextInput::make('uid_number')
->label('UID Nummer')
->rules([new VatNumber])
->required(),
TextInput::make('konto_title')
TextInput::make('title')
->label('Title')
->required(),
Select::make('konto_gender')
Select::make('gender')
->label('Geschlecht')
->options([
'Herr' => 'Herr',
@@ -53,11 +53,8 @@ class KontoForm
'Non-binary' => 'Non-binary',
])
->required(),
TextInput::make('konto_first_name')
->label('Vorname')
->required(),
TextInput::make('konto_last_name')
->label('Nachname')
TextInput::make('name')
->label('Name')
->required(),
]);
}
@@ -23,42 +23,42 @@ class KontosTable
return $table
->columns([
// TextColumn::make('id'),
// TextColumn::make('konto_gender')->label('Geschlecht'),
// TextColumn::make('konto_title')->label('Title'),
// TextColumn::make('konto_first_name')->label('Vorname'),
// IconColumn::make('konto_agb_akzeptiert')
// TextColumn::make('gender')->label('Geschlecht'),
// TextColumn::make('title')->label('Title'),
// TextColumn::make('first_name')->label('Vorname'),
// IconColumn::make('agb_akzeptiert')
// ->label('AGB')
// ->boolean()
// ->trueIcon(Heroicon::OutlinedCheckBadge)
// ->falseIcon(Heroicon::OutlinedXMark),
// PhoneColumn::make('konto_phone')
// PhoneColumn::make('phone')
// ->label('Telefon')
// ->displayFormat(PhoneInputNumberType::INTERNATIONAL),
// TextColumn::make('konto_email')
// TextColumn::make('email')
// ->copyable()
// ->copyMessage('E-Mail wurde kopiert')
// ->copyMessageDuration(1500)
// ->label('E-mail'),
TextColumn::make('konto_company')->label('Firma')
->description(fn ($record): string => $record->konto_address.', '.$record->konto_location),
TextColumn::make('company')->label('Firma')
->description(fn ($record): string => $record->address.', '.$record->location),
TextColumn::make('konto_option.name')
TextColumn::make('option.name')
->icon(Heroicon::CurrencyEuro)
// ->iconColor('success')
// ->badge()
->label('Plan')
->description(fn ($record): string => $record->konto_option->payment_plan->name),
->description(fn ($record): string => $record->option->payment_plan->name),
TextColumn::make('konto_gutachten_abgeschlossen')
TextColumn::make('gutachten_abgeschlossen')
->size(TextSize::Large)
->weight(FontWeight::Bold)
->label('Abgeschlossen')
->color('primary')
->description('Gutachten')
->alignCenter(),
TextColumn::make('konto_gutachten_zahl')
TextColumn::make('gutachten_zahl')
->size(TextSize::Large)
->weight(FontWeight::Bold)
->label('Freigeschalted')
@@ -27,9 +27,9 @@ class PermissionResource extends Resource
protected static ?string $recordTitleAttribute = 'name';
protected static ?string $navigationLabel = 'Berechtigungen';
protected static ?string $navigationLabel = 'Berechtigung';
protected static ?string $modelLabel = 'Berechtigungen';
protected static ?string $modelLabel = 'Berechtigung';
protected static ?string $pluralModelLabel = 'Berechtigungen';
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Plans\Pages;
use App\Filament\Resources\Plans\PlanResource;
use Filament\Resources\Pages\CreateRecord;
class CreatePlan extends CreateRecord
{
protected static string $resource = PlanResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Plans\Pages;
use App\Filament\Resources\Plans\PlanResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditPlan extends EditRecord
{
protected static string $resource = PlanResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Plans\Pages;
use App\Filament\Resources\Plans\PlanResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListPlans extends ListRecords
{
protected static string $resource = PlanResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}
@@ -0,0 +1,64 @@
<?php
namespace App\Filament\Resources\Plans;
use App\Filament\Clusters\Administration\AdministrationCluster;
use App\Filament\Resources\Plans\Pages\CreatePlan;
use App\Filament\Resources\Plans\Pages\EditPlan;
use App\Filament\Resources\Plans\Pages\ListPlans;
use App\Filament\Resources\Plans\Schemas\PlanForm;
use App\Filament\Resources\Plans\Tables\PlansTable;
use App\Models\Plan;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use UnitEnum;
class PlanResource extends Resource
{
protected static ?string $model = Plan::class;
protected static string|BackedEnum|null $navigationIcon = 'lucide-key-square';
protected static ?string $cluster = AdministrationCluster::class;
protected static string|UnitEnum|null $navigationGroup = 'Kunden';
protected static ?string $navigationLabel = 'Zahlungsplan';
protected static ?string $modelLabel = 'Zahlungsplan';
protected static ?string $pluralModelLabel = 'Zahlungspläne';
public static function form(Schema $schema): Schema
{
return PlanForm::configure($schema);
}
public static function table(Table $table): Table
{
return PlansTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListPlans::route('/'),
'create' => CreatePlan::route('/create'),
'edit' => EditPlan::route('/{record}/edit'),
];
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->count();
}
}
@@ -1,10 +1,10 @@
<?php
namespace App\Filament\Resources\KontoOptions\Schemas;
namespace App\Filament\Resources\Plans\Schemas;
use Filament\Schemas\Schema;
class KontoOptionForm
class PlanForm
{
public static function configure(Schema $schema): Schema
{
@@ -1,26 +1,19 @@
<?php
namespace App\Filament\Resources\KontoOptions\Tables;
namespace App\Filament\Resources\Plans\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class KontoOptionTable
class PlansTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('name')
->description(fn ($record): string => $record->description)
->wrap(),
TextColumn::make('payment_plan.name')
->label('Zahlung'),
TextColumn::make('number_user')->alignCenter()->badge()->label('Benutzer'),
TextColumn::make('number_gutachter')->alignCenter()->badge()->label('Gutachter'),
//
])
->filters([
//
@@ -13,7 +13,12 @@ class ListUsers extends ListRecords
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
CreateAction::make()
->mutateDataUsing(function (array $data): array {
$data['konto_id'] = auth()->user()->konto_id;
return $data;
}),
];
}
}
@@ -2,22 +2,55 @@
namespace App\Filament\Resources\Users\Schemas;
use App\Models\User;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Illuminate\Validation\Rules\Password;
class UserForm
{
public User $user;
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('name'),
Section::make('Benutzerkonto')
->icon('lucide-user')
->schema([
TextInput::make('name')->required(),
TextInput::make('email')->email()
->required()
->label('E-Mail'),
]),
Section::make('Sicherheit')
->icon('lucide-lock')
->schema([
TextInput::make('password')
->label('Passwort')
->password() // Masks the input
->required()
->revealable()
->rule(Password::min(8)->mixedCase()->numbers()->symbols()->uncompromised()) // Enforces strong password policies
->dehydrateStateUsing(fn ($state) => bcrypt($state)) // Hashes the password before saving
->label('Password'),
TextInput::make('password_confirmation')
->password() // Masks the input
->required()
->same('password') // Validates that this matches the 'password' field
->label('Passwort Bestätigen'),
]),
Select::make('roles')
->label('Rolle')
->visible(fn () => auth()->user()->hasRole('super_admin'))
->relationship('roles', 'name')
->multiple()
->preload()
->searchable(),
]);
])->columns(1);
}
}
@@ -18,10 +18,12 @@ class UsersTable
return $table
->columns([
TextColumn::make('name'),
TextColumn::make('konto.company')->badge(),
TextColumn::make('email')->copyable()->label('E-Mail'),
//
])
->filters([
TrashedFilter::make(),
TrashedFilter::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
])
->recordActions([
EditAction::make(),
@@ -31,7 +33,7 @@ class UsersTable
DeleteBulkAction::make(),
ForceDeleteBulkAction::make(),
RestoreBulkAction::make(),
]),
])->visible(fn () => auth()->user()->hasRole('super_admin')),
]);
}
}
@@ -3,8 +3,6 @@
namespace App\Filament\Resources\Users;
use App\Filament\Clusters\Verwaltung\VerwaltungCluster;
use App\Filament\Resources\Users\Pages\CreateUser;
use App\Filament\Resources\Users\Pages\EditUser;
use App\Filament\Resources\Users\Pages\ListUsers;
use App\Filament\Resources\Users\Schemas\UserForm;
use App\Filament\Resources\Users\Tables\UsersTable;
@@ -57,8 +55,6 @@ class UserResource extends Resource
{
return [
'index' => ListUsers::route('/'),
'create' => CreateUser::route('/create'),
'edit' => EditUser::route('/{record}/edit'),
];
}
+1 -1
View File
@@ -12,7 +12,7 @@ class KontoSwitch extends Component
public function mount()
{
$this->kontos = Konto::pluck('konto_company', 'id')->all();
$this->kontos = Konto::pluck('company', 'id')->all();
}
public function render()
+2 -2
View File
@@ -40,8 +40,8 @@ class Konto extends Model
return KontoFactory::new();
}
public function konto_option(): HasOne
public function plan(): HasOne
{
return $this->hasOne(KontoOption::class, 'id', 'konto_option_id');
return $this->hasOne(Plan::class);
}
}
-14
View File
@@ -1,14 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
class KontoOption extends Model
{
public function payment_plan(): HasOne
{
return $this->hasOne(PaymentPlan::class, 'id', 'payment_plan_id');
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Plan extends Model
{
//
}
+49 -50
View File
@@ -3,13 +3,16 @@
namespace App\Models;
use App\Models\Scopes\KontoScope;
use Database\Factories\UserFactory;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
use Filament\Auth\MultiFactor\Email\Contracts\HasEmailAuthentication;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
@@ -32,22 +35,13 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
'email',
'password',
'app_verified_at',
'konto_title',
'konto_gender',
'konto_first_name',
'konto_last_name',
'konto_company',
'konto_email',
'konto_address',
'konto_location',
'konto_plz',
'konto_country',
'konto_phone',
'konto_uid_number',
'konto_agb_akzeptiert',
];
protected static function newFactory(): Factory
{
return UserFactory::new();
}
/**
* The attributes that should be hidden for serialization.
*
@@ -81,45 +75,50 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
{
static::addGlobalScope(new KontoScope);
static::creating(function (User $user) {
// static::creating(function (User $user) {
if (isset($user->konto_title)) {
// if (isset($user->konto_title)) {
$konto = Konto::create([
'konto_title' => $user->konto_title,
'konto_gender' => $user->konto_gender,
'konto_company' => $user->konto_company,
'konto_uid_number' => $user->konto_uid_number,
'konto_location' => $user->konto_location,
'konto_plz' => $user->konto_plz,
'konto_agb_akzeptiert' => $user->konto_agb_akzeptiert,
'konto_country' => $user->konto_country,
'konto_address' => $user->konto_address,
'konto_first_name' => $user->konto_first_name,
'konto_last_name' => $user->konto_last_name,
'konto_email' => $user->konto_email,
'konto_phone' => $user->konto_phone,
]);
$user->konto_id = $konto->id;
// $konto = Konto::create([
// 'konto_title' => $user->konto_title,
// 'konto_gender' => $user->konto_gender,
// 'konto_company' => $user->konto_company,
// 'konto_uid_number' => $user->konto_uid_number,
// 'konto_location' => $user->konto_location,
// 'konto_plz' => $user->konto_plz,
// 'konto_agb_akzeptiert' => $user->konto_agb_akzeptiert,
// 'konto_country' => $user->konto_country,
// 'konto_address' => $user->konto_address,
// 'konto_first_name' => $user->konto_first_name,
// 'konto_last_name' => $user->konto_last_name,
// 'konto_email' => $user->konto_email,
// 'konto_phone' => $user->konto_phone,
// ]);
// $user->konto_id = $konto->id;
unset($user->konto_title);
unset($user->konto_gender);
unset($user->konto_company);
unset($user->konto_uid_number);
unset($user->konto_location);
unset($user->konto_plz);
unset($user->konto_agb_akzeptiert);
unset($user->konto_country);
unset($user->konto_address);
unset($user->konto_first_name);
unset($user->konto_last_name);
unset($user->konto_email);
unset($user->konto_phone);
}
$user->app_verified_at = now();
$user->email_verified_at = now();
$user->assignRole('gutachter');
});
// unset($user->konto_title);
// unset($user->konto_gender);
// unset($user->konto_company);
// unset($user->konto_uid_number);
// unset($user->konto_location);
// unset($user->konto_plz);
// unset($user->konto_agb_akzeptiert);
// unset($user->konto_country);
// unset($user->konto_address);
// unset($user->konto_first_name);
// unset($user->konto_last_name);
// unset($user->konto_email);
// unset($user->konto_phone);
// }
// $user->app_verified_at = now();
// $user->email_verified_at = now();
// $user->assignRole('gutachter');
// });
}
public function konto(): HasOne
{
return $this->hasOne(Konto::class, 'id', 'konto_id');
}
public function getAppAuthenticationSecret(): ?string
+70
View File
@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\Plan;
use Illuminate\Auth\Access\HandlesAuthorization;
class PlanPolicy
{
use HandlesAuthorization;
public function viewAny(AuthUser $authUser): bool
{
return $authUser->can('ViewAny:Plan');
}
public function view(AuthUser $authUser, Plan $plan): bool
{
return $authUser->can('View:Plan');
}
public function create(AuthUser $authUser): bool
{
return $authUser->can('Create:Plan');
}
public function update(AuthUser $authUser, Plan $plan): bool
{
return $authUser->can('Update:Plan');
}
public function delete(AuthUser $authUser, Plan $plan): bool
{
return $authUser->can('Delete:Plan');
}
public function restore(AuthUser $authUser, Plan $plan): bool
{
return $authUser->can('Restore:Plan');
}
public function forceDelete(AuthUser $authUser, Plan $plan): bool
{
return $authUser->can('ForceDelete:Plan');
}
public function forceDeleteAny(AuthUser $authUser): bool
{
return $authUser->can('ForceDeleteAny:Plan');
}
public function restoreAny(AuthUser $authUser): bool
{
return $authUser->can('RestoreAny:Plan');
}
public function replicate(AuthUser $authUser, Plan $plan): bool
{
return $authUser->can('Replicate:Plan');
}
public function reorder(AuthUser $authUser): bool
{
return $authUser->can('Reorder:Plan');
}
}