where('designation', 'Prüfprogramm Abstand')->first(); if ($existing !== null) { $this->info('Prüfbestand ist bereits vorhanden.'); return self::SUCCESS; } $actor = User::query()->find($this->option('actor')) ?? User::query()->orderBy('id')->first(); if ($actor === null) { $this->error('Es gibt kein Konto, das die Anzeigefreigabe zeichnen kann.'); return self::FAILURE; } $kind = EditorialContentKind::query()->where('slug', 'programm')->first(); if ($kind === null) { $this->error('Die Inhaltsart Programm fehlt.'); return self::FAILURE; } $sheet = $content->publishElementVersion( $content->createElement('text', 'document', 'Prüfblatt Abstand'), 'Gekennzeichneter Prüftext. Kein Veröffentlichungstext.', ); $composition = $content->createComposition('Prüfprogramm Abstand'); $composition->editorial_content_kind_id = $kind->id; $composition->display_title = 'Prüfprogramm Abstand'; $composition->summary = 'Gekennzeichneter Prüfbestand für die Testinstanz.'; $composition->thumbnail_error = 'Prüfhinweis: kein Vorschaubild.'; $composition->save(); $version = $content->publishComposition($composition, [ ['role' => 'Blatt', 'target' => $sheet], ], $actor, 'Prüfbestand', [ 'learning_goal' => 'Den Prüfaufbau in der Bibliothek sehen.', 'duration_minutes' => 5, 'material_note' => 'Nur der Prüftext.', ]); $article = $articles->create('pruef-abstand'); $articles->publishRelease($article, $version, 'Prüffassung.'); $rights = $offers->createRightsProfile('Prüfblatt ansehen', 'ehrenamtlich', [ 'document' => ['ansehen', 'laden'], ]); $offer = $offers->create('Prüfprogramm Abstand'); $offers->activate($offer, [ ['target' => $article->fresh(), 'rights' => $rights], ], ['grant_kind' => 'auf_abruf', 'composition_version_id' => $version->id]); $display->release($version, $actor, 'Prüffreigabe'); $this->info('Prüfbestand angelegt. Angebot: Prüfprogramm Abstand.'); return self::SUCCESS; } }