public function signing($foreignKey, $otherKey): \Illuminate\Database\Eloquent\Relations\HasMany { var_dump($foreignKey,$otherKey); return $this->hasMany(SigningLog::class,$foreignKey,$otherKey); }如何在with使用的时候把这两个变量传入
时间: 2024-03-12 15:49:33 浏览: 16
你可以在使用with方法时,将这两个变量作为参数传入,例如:
```
$foreignKey = 'user_id';
$otherKey = 'id';
$models = Model::with(['signing' => function($query) use ($foreignKey, $otherKey) {
$query->signing($foreignKey, $otherKey);
}])->get();
```
在上述代码中,我们首先定义了$foreignKey和$otherKey两个变量,然后在使用with方法时,通过匿名函数传入这两个变量。在匿名函数中,我们调用了signing方法,并将$foreignKey和$otherKey作为参数传入。这样就可以在关联查询中使用这两个变量了。
相关问题
下载RabbitMQ public signing key
你可以按照以下步骤下载RabbitMQ public signing key:
1. 打开终端或命令行窗口,进入任意目录。
2. 执行以下命令下载rabbitmq-signing-key-public.asc文件:
wget https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-signing-key-public.asc
或者使用curl命令下载:
curl https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-signing-key-public.asc --output rabbitmq-signing-key-public.asc
3. 下载完成后,你可以使用该文件来验证RabbitMQ发布包的完整性。
AttributeError: type object 'Signing_progress' has no attribute 'json'
AttributeError: type object 'Signing_progress' has no attribute 'json' 是一个错误提示,意味着在 'Signing_progress' 类型的对象中没有名为 'json' 的属性。
这个错误通常发生在尝试访问一个不存在的属性时。可能有以下几种原因导致这个错误:
1. 拼写错误:请确保属性名的拼写是正确的,大小写也要匹配。
2. 属性不存在:检查一下 'Signing_progress' 类型的对象是否真的有 'json' 属性。你可以查看相关的代码或者文档来确认。
3. 类型错误:如果 'Signing_progress' 是一个自定义类,那么可能是在定义类的时候忘记添加 'json' 属性了。你可以检查一下类的定义,看看是否缺少了这个属性。
如果你能提供更多的上下文信息,比如相关的代码片段或者更详细的错误信息,我可以给出更具体的帮助。
相关推荐
![pub](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)