小编use*_*937的帖子

Laravel 验证:保释规则不起作用

根据Laravel 文档bail规则应该在第一次验证失败后停止运行验证规则。

我在App\Http\*命名空间外有一个文件,其中包含以下代码:

if(Validator::make($params, [
    'email' => 'bail|required|email|max:60|exists:customers,email',
    'password' => 'required|max:60|string',
    'password' => new CustomerCheckPassword($params['email']),
]) -> fails())
    throw new Exception('message here');

Run Code Online (Sandbox Code Playgroud)

像魅力一样工作,除了bail规则来自email属性不会在不$params['email']被包含时停止验证customers.email,并且继续password。您对这个问题有什么想法或优雅的解决方法吗?

php validation laravel

6
推荐指数
1
解决办法
1955
查看次数

CSS:表格 - 带有 colspan 的行 - 在悬停时更改整行颜色

我希望这不会重复。我希望整行都有颜色tr[child]:hover

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<style type="text/css">

		tr[origin]:hover {
			background-color: grey;
		}

		tr[origin]:hover + tr[child]{
			background-color: grey;
		}

		tr[child]:hover {
			background-color: grey;
		}

	</style>
</head>
<body>
	<table border="1px">

		<tr origin>
			<td rowspan="2">1</td>
			<td colspan="2">Question</td>
			<td rowspan="2">2/3</td>
			<td rowspan="2">View answer</td>
		</tr>
		<tr child>
			<td>Rasp 1</td>
			<td>Rasp2</td>
		</tr>

		<tr origin>
			<td rowspan="2">1</td>
			<td colspan="2">Question</td>
			<td rowspan="2">2/3</td>
			<td rowspan="2">View answer</td>
		</tr>
		<tr child>
			<td>Rasp 1</td>
			<td>Rasp2</td>
		</tr>
	</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
1
解决办法
352
查看次数

错误:集合方法聚合是同步的

我正在尝试以下代码:

const Conn = mongoose.createConnection('mongodb://127.0.0.1:27017/db');

const addresses = Conn.collection('users').aggregate([
  {
    $project: {
      _id: false,
      ethAddr: true,
    }
  }
]);

Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

[...]\backend\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:100
        throw new Error('Collection method ' + i + ' is synchronous');
              ^

Error: Collection method aggregate is synchronous
    at NativeCollection.<computed> [as aggregate] ([...]\backend\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:100:15)
    at file:///[...]/backend/scripts/dbGetMerkleRoot.js:11:46
    at file:///[...]/backend/scripts/dbGetMerkleRoot.js:28:3
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)
Run Code Online (Sandbox Code Playgroud)

以牛的名义我做错了什么?

javascript mongoose

4
推荐指数
1
解决办法
2191
查看次数

Laravel:防止 Updated_at 在记录创建时填充

在 Laravel >=5.8 的最新版本中,我注意到当您创建新模型记录时,updated_at表中的列会自动填充与 相同的值created_at。虽然填写是有意义的,created_atModel::create()填写的意义updated_at何在?NULL在我看来,保留Laravel 5.8 之前的样子更有意义

是否有已知的简单方法来禁用这种新行为?

php laravel eloquent

3
推荐指数
1
解决办法
1765
查看次数

标签 统计

laravel ×2

php ×2

css ×1

eloquent ×1

html ×1

javascript ×1

mongoose ×1

validation ×1