App\Classes\Validator::extend('alpha', function ($attribute, $value, $parameters) { return ctype_alpha(preg_replace('/\\s/', '', $value)); }); App\Classes\Validator::extend('gender', function ($attribute, $value, $parameters) { return !($value != 1 && $value != 0); }); App\Classes\Validator::extend('email', function ($attribute, $value, $parameters) { return filter_var($value, FILTER_VALIDATE_EMAIL); }); App\Classes\Validator::extend('unique', function ($attribute, $value, $parameters) { if (!isset($parameters[0], $parameters[1])) { throw new Exception('The unique rule not has enough parameters.'); } $table = $parameters[0]; $column = $parameters[1]; $unique = Illuminate\Database\Capsule\Manager::table($table)->where($column, '=', $value)->first(); return is_null($unique); }); App\Classes\Validator::extend('maxwords', function ($attribute, $value, $parameters) { if (!isset($parameters[0])) { throw new Exception('The unique rule not has enough parameters.'); } return !(str_word_count($value) > $parameters[0]); }); App\Classes\Validator::extend('vocation', function ($attribute, $value, $parameters) { return in_array($value, config('character', 'newcharvocations')); }); App\Classes\Validator::extend('town', function ($attribute, $value, $parameters) { return in_array($value, config('character', 'newchartowns')); }); App\Classes\Validator::extend('charname', function ($attribute, $value, $parameters) {