PHP 8.3.31
Preview: ClosureValidationRule.php Size: 1.93 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php

<?php

namespace Illuminate\Validation;

use Illuminate\Contracts\Validation\Rule as RuleContract;
use Illuminate\Contracts\Validation\ValidatorAwareRule;
use Illuminate\Translation\CreatesPotentiallyTranslatedStrings;

class ClosureValidationRule implements RuleContract, ValidatorAwareRule
{
    use CreatesPotentiallyTranslatedStrings;

    /**
     * The callback that validates the attribute.
     *
     * @var \Closure
     */
    public $callback;

    /**
     * Indicates if the validation callback failed.
     *
     * @var bool
     */
    public $failed = false;

    /**
     * The validation error messages.
     *
     * @var array
     */
    public $messages = [];

    /**
     * The current validator.
     *
     * @var \Illuminate\Validation\Validator
     */
    protected $validator;

    /**
     * Create a new Closure based validation rule.
     *
     * @param  \Closure  $callback
     * @return void
     */
    public function __construct($callback)
    {
        $this->callback = $callback;
    }

    /**
     * Determine if the validation rule passes.
     *
     * @param  string  $attribute
     * @param  mixed  $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        $this->failed = false;

        $this->callback->__invoke($attribute, $value, function ($attribute, $message = null) {
            $this->failed = true;

            return $this->pendingPotentiallyTranslatedString($attribute, $message);
        }, $this->validator);

        return ! $this->failed;
    }

    /**
     * Get the validation error messages.
     *
     * @return array
     */
    public function message()
    {
        return $this->messages;
    }

    /**
     * Set the current validator.
     *
     * @param  \Illuminate\Validation\Validator  $validator
     * @return $this
     */
    public function setValidator($validator)
    {
        $this->validator = $validator;

        return $this;
    }
}

Directory Contents

Dirs: 2 × Files: 19

Name Size Perms Modified Actions
Concerns DIR
- drwxrwxrwx 2025-09-17 06:52:58
Edit Download
Rules DIR
- drwxrwxrwx 2025-09-17 06:52:58
Edit Download
1.93 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.31 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
2.43 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
3.60 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
287 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
8.90 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
3.81 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.28 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
2.54 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
846 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
6.40 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
128 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
2.16 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
2.86 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
3.67 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
9.66 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
2.14 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
41.94 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).