File "FieldReference.php"

Full Path: /var/www/html/back/vendor/spatie/laravel-data/src/Support/Validation/References/FieldReference.php
File size: 465 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace Spatie\LaravelData\Support\Validation\References;

use Spatie\LaravelData\Support\Validation\ValidationPath;

class FieldReference
{
    public function __construct(
        public readonly string $name,
        public readonly bool $fromRoot = false,
    ) {
    }

    public function getValue(ValidationPath $path): string
    {
        return $this->fromRoot
            ? $this->name
            : $path->property($this->name)->get();
    }
}