getRecord(); return $form ->schema( array_merge( parent::getForm($form)->getComponents(), [ Hidden::make(Video::ATTRIBUTE_ID) ->label(__('filament.resources.singularLabel.video')) ->default(fn (BaseRelationManager|ListScripts $livewire) => $livewire instanceof BaseRelationManager ? $livewire->getOwnerRecord()->getKey() : null), ], ) ); } /** * Get the underlying storage action. * * @param array $fields * @return UploadScript */ protected function storageAction(array $fields): UploadScript { /** @var UploadedFile $file */ $file = Arr::get($fields, 'file'); /** @var string $path */ $path = Arr::get($fields, 'path'); /** @var Video|null $video */ $video = Video::query()->find(Arr::get($fields, Video::ATTRIBUTE_ID)); return new UploadScript($file, $path, $video); } /** * The name of the disk. * * @return string */ public function disk(): string { return Config::get(VideoConstants::SCRIPT_DISK_QUALIFIED); } /** * Get the file validation rules. * * @return array */ protected function fileRules(): array { return [ 'required', FileRule::types('txt')->max(2 * 1024), ]; } }