Laravel雄辩的查询->未定义的变量

时间:2018-07-07 10:25:24

标签: php laravel eloquent

随附的是我面临的错误的屏幕截图。我的日志显示$ team变量的值。我究竟做错了什么? enter image description here

2 个答案:

答案 0 :(得分:2)

您无权从闭包访问父变量,您需要使用 use 关键字

将变量显式发送到闭包
function($query) use ($team)

答案 1 :(得分:1)

使用忘记在闭包内部使用$ team变量。它必须是import * as imagepicker from "nativescript-imagepicker"; import * as fs from "file-system"; export class MyWebChromeClient extends android.webkit.WebChromeClient { file_path:string; constructor() { super(); return global.__native(this); } onShowFileChooser(webView,filePathCallback,fileChooserParams) { this.filepathCallback(filePathCallback); return true; } filepathCallback(filePathCallback) { let context = imagepicker.create({ mode: "single", mediaType: imagepicker.ImagePickerMediaType.Any }); this.startSelection(context,filePathCallback); } startSelection(context,filePathCallback) { context.authorize().then(() => { return context.present(); }) .then((selection) => { selection.forEach((selected) => { let path = selected.android; let file = fs.File.fromPath(path); this.file_path = file.path; this.file_path = "file://" + this.file_path; let results = Array.create(android.net.Uri, 1); results[0] = android.net.Uri.parse(this.file_path); filePathCallback.onReceiveValue(results); return this.file_path; }); }).catch(function (e) { console.log(e); }); } }

function($query) use ($team)