當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validator::with方法代碼示例

本文整理匯總了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);
 }
開發者ID:narrowspark,項目名稱:framework,代碼行數:11,代碼來源:Validator.php

示例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())];
 }
開發者ID:jamesvweston,項目名稱:laravel-measurements,代碼行數:5,代碼來源:WeightConversion.php

示例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())];
 }
開發者ID:jamesvweston,項目名稱:laravel-measurements,代碼行數:5,代碼來源:DistanceConversion.php

示例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';
開發者ID:havenshen,項目名稱:slim-born,代碼行數:31,代碼來源:app.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())];
 }
開發者ID:jamesvweston,項目名稱:laravel-measurements,代碼行數:5,代碼來源:TaxType.php

示例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);
 */
開發者ID:Vaizard,項目名稱:Glued,代碼行數:31,代碼來源:bootstrap.php


注:本文中的Respect\Validation\Validator::with方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。