Loheide-eu-mitarbeiterplatt.../app/Http/Requests/UpdateProfileRequest.php
Friederich Loheide 6269d3302c
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m43s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m52s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m49s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m49s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 2m12s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 1m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 57s
Beliebige Entra-Attribute ins Profil übernehmen; eigene Profilfelder
- Profilfelder frei definierbar (Typ, Sichtbarkeit, selbst pflegbar), Werte als JSON am Benutzer
- Attribut-Zuordnung je Anbieter statt fester Feldliste: jedes Graph-Attribut inkl.
  verschachtelter Pfade, onPremisesExtensionAttributes und Verzeichniserweiterungen
- Erweiterungsattribute per Knopf aus Entra laden
- $select dynamisch aus der Zuordnung; Delta-Abgleich startet bei geänderter Zuordnung neu
- Rückfall auf Grundattribute, wenn einzelne Attribute nicht lesbar sind
- Ältere Konfiguration (synced_fields) wird weiter gelesen

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 08:09:57 +00:00

54 lines
1.9 KiB
PHP

<?php
namespace App\Http\Requests;
use App\Support\ProfileFields;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateProfileRequest extends FormRequest
{
/**
* @return array<string, mixed>
*/
public function rules(): array
{
$managed = $this->user()->managedFields();
return [
'first_name' => [in_array('first_name', $managed, true) ? 'nullable' : 'required', 'string', 'max:100'],
'last_name' => [in_array('last_name', $managed, true) ? 'nullable' : 'required', 'string', 'max:100'],
'email' => [
in_array('email', $managed, true) ? 'nullable' : 'required', 'string', 'lowercase', 'email', 'max:255',
Rule::unique('users')->ignore($this->user()->id),
],
'job_title' => ['nullable', 'string', 'max:150'],
'department' => ['nullable', 'string', 'max:150'],
'location' => ['nullable', 'string', 'max:150'],
'phone' => ['nullable', 'string', 'max:50'],
'mobile' => ['nullable', 'string', 'max:50'],
'about' => ['nullable', 'string', 'max:2000'],
'custom_fields' => ['nullable', 'array'],
...app(ProfileFields::class)->rules(),
];
}
/**
* @return array<string, string>
*/
public function attributes(): array
{
return [
'first_name' => 'Vorname',
'last_name' => 'Nachname',
'email' => 'E-Mail-Adresse',
'job_title' => 'Funktion',
'department' => 'Abteilung',
'location' => 'Standort',
'phone' => 'Telefon',
'mobile' => 'Mobil',
'about' => 'Über mich',
...app(ProfileFields::class)->all()->mapWithKeys(fn ($field) => ['custom_fields.'.$field->key => $field->label])->all(),
];
}
}