HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/app/KommaApp/Shop/FormValidation/BaseForm.php
<?php

namespace KommaApp\Shop\FormValidation;

use Illuminate\Validation\Factory as Validator;

class BaseForm
{
    /*
    * Relevant error messages
    */
    protected $errorMessages;

    /**
     * All error messages
     * @var array
     */
    protected $messages = [];

    /**
     * @var \Illuminate\Validation\Factory $validatorFactory
     */
    protected $validatorFactory;

    function __construct(Validator $validatorFactory)
    {
        $this->validatorFactory = $validatorFactory;
    }

    /*
     * @parameter Input $input
     * @return boolean
     */
    public function isValid($input)
    {
        $validation = $this->validatorFactory->make($input, $this->rules, $this->messages);

        if($validation->fails())
        {
            $this->errorMessages = $validation->messages();
            return false;
        }
        return true;
    }

    /*
     * Get error messages
     * @return Array
     */
    public function errorMessages()
    {
        return $this->errorMessages;
    }
}