label('Rechteprofil anlegen')->schema([ TextInput::make('name')->label('Name')->required(), Select::make('purpose')->label('Zweck')->options([ 'ehrenamtlich' => 'Ehrenamtlich', 'kommerziell' => 'Kommerziell', 'institutionell' => 'Institutionell', ])->required(), CheckboxList::make('capabilities')->label('Fähigkeiten')->options([ 'film:streamen' => 'Film ansehen', 'film:laden' => 'Film herunterladen', 'audio:streamen' => 'Hörstück ansehen', 'document:ansehen' => 'Dokument ansehen', 'document:laden' => 'Dokument herunterladen', 'pdf:ansehen' => 'PDF ansehen', 'pdf:laden' => 'PDF herunterladen', 'text:ansehen' => 'Text ansehen', 'bild:ansehen' => 'Bild ansehen', ])->required(), ])->action(function (array $data): void { $this->report(function () use ($data): void { $capabilities = []; foreach ($data['capabilities'] as $entry) { [$class, $action] = explode(':', $entry, 2); $capabilities[$class][] = $action; } app(OfferService::class)->createRightsProfile($data['name'], $data['purpose'], $capabilities); }, 'Das Rechteprofil ist angelegt.'); }), ]; } }