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;
}
}