mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Ran model helper, added some new features.
This commit is contained in:
22
app/lib/Firefly/Validation/FireflyValidator.php
Normal file
22
app/lib/Firefly/Validation/FireflyValidator.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace Firefly\Validation;
|
||||
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class FireflyValidator
|
||||
*
|
||||
* @package Firefly\Validation
|
||||
*/
|
||||
class FireflyValidator extends Validator
|
||||
{
|
||||
public function validateAlphabasic($attribute, $value, $parameters)
|
||||
{
|
||||
$pattern = '/[^a-z_\-0-9 ]/i';
|
||||
if (preg_match($pattern, $value)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
22
app/lib/Firefly/Validation/ValidationServiceProvider.php
Normal file
22
app/lib/Firefly/Validation/ValidationServiceProvider.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Firefly\Validation;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ValidationServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
$this->app->validator->resolver(
|
||||
function ($translator, $data, $rules, $messages) {
|
||||
return new FireflyValidator($translator, $data, $rules, $messages);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user