user() !== null; } public function rules(): array { $bytes = (int) config('nova_cards.validation.max_background_upload_bytes', 8 * 1024 * 1024); $maxKilobytes = (int) ceil($bytes / 1024); return [ 'background' => [ 'bail', 'required', 'file', static function (string $attribute, mixed $value, Closure $fail): void { if (! $value instanceof UploadedFile) { return; } $path = $value->getRealPath() ?: $value->getPathname(); if (! $value->isValid() || ! is_string($path) || trim($path) === '') { $fail('The ' . $attribute . ' upload is invalid.'); } }, 'image', 'mimes:jpeg,jpg,png,webp', 'max:' . $maxKilobytes, Rule::dimensions()->minWidth(480)->minHeight(480), ], ]; } }