本文整理汇总了PHP中Respect\Validation\Validator::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::with方法的具体用法?PHP Validator::with怎么用?PHP Validator::with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Respect\Validation\Validator
的用法示例。
在下文中一共展示了Validator::with方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: with
/**
* Add your own rule's namespace.
*
* @param string $namespace
*
* @codeCoverageIgnore
*/
public function with(string $namespace, bool $overwrite = false)
{
RespectValidator::with($namespace, $overwrite);
}
示例2: getValidationRules
protected function getValidationRules()
{
v::with('app\\Models\\Validation\\');
return [v::attribute('name', v::notEmpty()->alpha()->length(2, 100)->UniqueDimensionUOMName()), v::attribute('symbol', v::notEmpty()->alpha()->length(2, 2)->UniqueDimensionUOMSymbol()), v::attribute('routeTransaction', v::instance('app\\Models\\RouteTransaction')), v::attribute('statusId', v::notEmpty()->int()->positive()), v::attribute('createdAt', v::notEmpty()->date()), v::attribute('expiresAt', v::notEmpty()->date())];
}
示例3: getValidationRules
protected function getValidationRules()
{
v::with('app\\Models\\Validation\\');
return [v::attribute('name', v::notEmpty()->alpha()->length(2, 100)), v::attribute('symbol', v::notEmpty()->alpha()->length(2, 2)), v::attribute('statusId', v::notEmpty()->int()->positive()), v::attribute('createdAt', v::notEmpty()->date()), v::attribute('expiresAt', v::notEmpty()->date())];
}
示例4: function
$container['flash'] = function ($container) {
return new \Slim\Flash\Messages();
};
$container['view'] = function ($container) {
$view = new \Slim\Views\Twig(__DIR__ . '/../resources/views/', ['cache' => false]);
$view->addExtension(new \Slim\Views\TwigExtension($container->router, $container->request->getUri()));
$view->getEnvironment()->addGlobal('auth', ['check' => $container->auth->check(), 'user' => $container->auth->user()]);
$view->getEnvironment()->addGlobal('flash', $container->flash);
return $view;
};
$container['validator'] = function ($container) {
return new App\Validation\validator();
};
$container['HomeController'] = function ($container) {
return new \App\Controllers\HomeController($container);
};
$container['AuthController'] = function ($container) {
return new \App\Controllers\Auth\AuthController($container);
};
$container['PasswordController'] = function ($container) {
return new \App\Controllers\Auth\PasswordController($container);
};
$container['csrf'] = function ($container) {
return new \Slim\Csrf\Guard();
};
$app->add(new \App\Middleware\ValidationErrorsMiddleware($container));
$app->add(new \App\Middleware\OldInputMiddleware($container));
$app->add(new \App\Middleware\CsrfViewMiddleware($container));
$app->add($container->csrf);
v::with('App\\Validation\\Rules\\');
require __DIR__ . '/../app/routes.php';
示例5: getValidationRules
protected function getValidationRules()
{
v::with('app\\Models\\Validation\\');
return [v::attribute('provider', v::oneOf(v::instance('app\\Models\\Provider'))), v::attribute('carrier', v::oneOf(v::instance('app\\Models\\Carrier'))), v::attribute('name', v::notEmpty()->length(3, 100)->alpha()->UniqueProviderName()), v::attribute('symbol', v::notEmpty()->length(3, 100)->UniqueProviderSymbol()), v::attribute('routeTransaction', v::instance('app\\Models\\RouteTransaction')), v::attribute('statusId', v::notEmpty()->int()->positive()), v::attribute('createdAt', v::notEmpty()->date()), v::attribute('expiresAt', v::notEmpty()->date())];
}
示例6: die
<?php
// Respect pulled in here because of v::with() below
use Respect\Validation\Validator as v;
//use Jsv4\Validator as jsonv;
session_start();
if (!file_exists(__DIR__ . '/settings.php')) {
die("Error 500: application configuration problem.");
}
require __DIR__ . '/../vendor/autoload.php';
// Instantiate the app, setup the path to our custom validation rules
$config = (require __DIR__ . '/settings.php');
$app = new \Slim\App($config);
v::with('Glued\\Classes\\Validation\\Rules\\');
// Set up dependencies
require __DIR__ . '/dependencies.php';
// Register middleware
require __DIR__ . '/middleware.php';
// Register routes
require __DIR__ . '/routes.php';
/*
* NOTE: psr-4 autoloading is turend on in composer.json. The psr-4 entry
* "Glued\\": "glued" corresponds to the application name "Glued\" (the
* additional backslash is for escaping) and the relative path to the "glued"
* directory. PSR-4 will autload things according to the following key:
* Glued=glued, Models=glued/Models, User=glued/Models/User.php, hence the
* following will work:
*
*$user = new \Glued\Models\User;
*print_r($user);
*/