好吧,这个问题让我感到难过......在嵌套的for循环数据出现时遇到一些麻烦:
<div v-if = "private.folders!=null" v-for="folder in private.folders">
{{folder.name}}
<div v-for="check in folder.checks">
{{check.name}}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用的数据如下所示:
folders [Array]
-object [this is a single 'folder']
--name
--checks [array] [each folder has this array]
---[object] [the actual 'check' object]
----[name]
Run Code Online (Sandbox Code Playgroud)
外循环工作得很好,并返回我期望的数据.但是,check.name不返回任何内容,并且控制台中没有错误.是否可以像这样做嵌套的for循环?
我可以使用HTTPS设置在我的本地环境中运行laravel-echo-server.但是,似乎我的生产服务器(基于Forge)存在问题:
Client cannot be authenticated, got HTTP status 405
Run Code Online (Sandbox Code Playgroud)
我能够通过HTTPS在本地测试私有通道,它工作正常,所以看起来它不是一个配置问题.
我应该提一下,我正在使用Laravel Passport,并且导致此错误的请求被抛出在常规auth中间件之外的页面上.
只是为了确保它不是我的身份验证方法,我在通道配置中返回'true':
Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
Broadcast::channel('channelReceiveLiveData.{id}', function ($user, $id) {
return true;
});
Broadcast::channel('channelReceiveTestState.{id}', function ($id) {
return true;
});
Run Code Online (Sandbox Code Playgroud)
以下是侦听私有通道的echo侦听器的版本:
Echo.private('channelReceiveLiveData.' + this.$route.params.testID)
.listen('liveDataTrigger', (e) => {
if (!that.state.hasPulledInitialData) {
console.log('Receiving data before initial pull done');
}
Run Code Online (Sandbox Code Playgroud)
我的laravel-echo-server.json文件:
"authHost": "https://app.test.com",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "....",
"key": "...."
}
],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": { …Run Code Online (Sandbox Code Playgroud) 运行OSX 10.10.1.我安装了自制软件,然后尝试运行以下命令:
brew install mcrypt
Run Code Online (Sandbox Code Playgroud)
之后,它经历了一个下载/安装文件的漫长过程.然后它给了我一个错误:
checking for mhash_keygen in -lmhash... no
configure: error: "You need at least libmhash 0.8.15 to compile this program.
http://mhash.sf.net/"
Run Code Online (Sandbox Code Playgroud)
在终端运行php -v:
PHP 5.6.2 (cli) (built: Nov 2 2014 09:34:41)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.在OSX Yosemite中,一切似乎都在破碎......
给出一个假设的查询,例如:
SELECT COUNT(*)
FROM subscriptions
GROUP by plan_type
Run Code Online (Sandbox Code Playgroud)
和下面的表类似:
+----+-----------------------+-------------+--+
| id | plan_type | customer_id | |
+----+-----------------------+-------------+--+
| 1 | gold_2017 | 523 | |
| 2 | gold_2016_recurring | 2300 | |
| 3 | silver_2016 | 234 | |
| 4 | silver_2017_recurring | 2593 | |
| 5 | platinum_recurring | 4123 | |
+----+-----------------------+-------------+--+
Run Code Online (Sandbox Code Playgroud)
期望的结果:
+-------+----------+
| count | type |
+-------+----------+
| 2 | gold |
| 2 | silver |
| 1 …Run Code Online (Sandbox Code Playgroud) 我正在编辑我的homestead.yaml文件,我确信缩进是正确的 - 但是我得到以下错误:
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
shell provisioner:
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
Run Code Online (Sandbox Code Playgroud)
我的homestead.yaml文件:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys: …Run Code Online (Sandbox Code Playgroud) 一两天前开始学习Swift.我遇到这个错误的次数比我想要的多 - 基本上,我意识到它与IBOutlets有关.删除故事板中的所有插座和按钮/对象,并手动重新添加它们似乎可以解决问题.
将来如果发生这个错误,并且我正在开展一个大型项目,我想知道如何诊断它是哪个IBOutlet,或者是什么导致它.
我有项目副本GitHub上这里如果有人想看看,并留下意见的几句话.
非常感谢提前!
2015-06-04 22:24:31.607 Controlling The Keyboard[1343:16382] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Controlling_The_Keyboard.ViewController 0x7f80896418b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key enterButton.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000104855c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001063c0bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001048558a9 -[NSException raise] + 9
3 Foundation 0x0000000104c73b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010479dd50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x00000001053cc52b -[UINib instantiateWithOwner:options:] …Run Code Online (Sandbox Code Playgroud) 更新至WordPress 4.7,并且在启用我的自定义插件之一时收到此错误:
( ! ) Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/vagrant/Sites/wordpress/wp includes/class-wp-hook.php on line 298
Run Code Online (Sandbox Code Playgroud)
我不确定是什么问题,因为堆栈跟踪看起来很神秘。关于什么可能损坏了插件或如何诊断问题的任何建议?
根据 VueRouter 文档,可以添加元字段并根据其值全局限制路由。
按照概述尝试实现后,我收到一个错误:
ReferenceError: record is not defined (line 46)
Run Code Online (Sandbox Code Playgroud)
这对应于这一行:
if (!hasCookies(record.meta.cookies)) {
Run Code Online (Sandbox Code Playgroud)
这是具有路由器保护逻辑的文件:
import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
const routes = [
{
path : '/authenticate/:id',
component : require ('./components/authenticate.vue'),
redirect: '/here',
},
// can only get here if the passcode has been filled out
{
path : '/client/create',
component : require('./components/createClientForm.vue'),
meta : {
cookies: ['passcode_cookie'], // need passcode to be able to create the client
redirect: '/authenticate/1' // dummy …Run Code Online (Sandbox Code Playgroud) 在减少同一行中的按钮之间的间距量方面存在问题。这些按钮包装在列中
JSFiddle
是否有捷径可寻?我想象使用负边距或填充不一定是理想的。
以下方法旨在返回一个包含另一个数组的数组'data'和一个对象(一些雄辩查询的结果)。
然而,它返回一个包含两个对象的数组;$data 以某种方式被转换为具有多个子对象的对象,而不是对象数组。需要注意的是dd($data),return 语句前的a表明它确实是一个对象数组。我认为处理响应的 Laravel 中间件以某种方式将其作为对象返回......
知道如何解决这个问题吗?
public function getTestData($id) {
$participants = Participant::where('test_id', $id)->with('testRecords')->get();
$finalRecordValue = TestRecord::where('test_id', $id)->orderBy('created_at', 'desc')->first();
$data = [];
foreach ($participants as $participant) {
foreach ($participant->testRecords as $testRecord) {
if (!array_key_exists((int)$testRecord->capture_timestamp, $data)) {
$data[$testRecord->capture_timestamp] = (object)[
'category' => $testRecord->capture_timestamp,
'value' . "_" . $participant->id => $testRecord->score
];
} else {
$data[$testRecord->capture_timestamp]->{"value" . "_" . $participant->id} = $testRecord->score;
}
}
}
return [$data, Auth::user()->tests()->findOrFail($id)];
}
Run Code Online (Sandbox Code Playgroud) SELECT id
FROM `events`
WHERE heading LIKE '%somestr%'
AND guests_since_start > 10
AND (SELECT COUNT(*)
FROM `submissions`
WHERE `submissions`.event_id = `events`.id)!=0;
Run Code Online (Sandbox Code Playgroud)
目前,此查询崩溃了我的服务器.我的想法是从事件表中获取所有id在提交表中具有相应行的事件(事件和提交由event_it链接.只要行数不为0,那么我希望显示这些记录.
问题是该events表有大约3,000条记录,而该submissions表大约有290,000 条记录.
任何有关此事的帮助表示赞赏.
假设应用程序商店中的人们已经在使用某个插件,是否有一种简单的方法可以在保留用户拥有的数据的同时强制数据库更新?必须擦除数据库并删除所有记录并不是理想的情况。
所考虑的具体操作是为现有记录添加一个具有已知值的列。
任何帮助表示赞赏!