本文整理汇总了PHP中DataModel::all方法的典型用法代码示例。如果您正苦于以下问题:PHP DataModel::all方法的具体用法?PHP DataModel::all怎么用?PHP DataModel::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataModel
的用法示例。
在下文中一共展示了DataModel::all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
include $file;
}
});
$data = ['userId' => 'sdfdffffffffff', 'tagId' => '234535', 'distanceRequire' => 'sdfdffffffffff', 'note' => '', 'insertTime' => '1456767657', 'lastReadTime' => '1456767657'];
$rules = [['tagId,userId,freeTime', 'required', 'msg' => '{attr} is required!'], ['note', 'email', 'skipOnEmpty' => false], ['insertTime', 'email', 'scene' => 'otherScene'], ['tagId', 'size', 'min' => 4, 'max' => 567], ['freeTime', 'size', 'min' => 4, 'max' => 567, 'when' => function ($data, $valid) {
echo " use when pre-check\n";
// $valid is current validation instance.
return true;
}], ['userId', function ($value, $data) {
echo " use custom validate\n";
var_dump($value, $data);
echo __LINE__ . "\n";
return false;
}, 'msg' => 'userId check failure!']];
echo "use ValidationTrait\n";
//$model = new DataModel($_POST,$rules);
$model = new DataModel();
$model->setData($data)->setRules($rules);
$model->validate();
var_dump($model->all(), $model->getErrors());
/*
echo "--------------\n";
echo "use Validation\n";
$valid = \inhere\validate\Validation::make($data, $rules)->validate();
var_dump(
$valid->all(),
$valid->getErrors()
);
*/