每当我在口才模型上使用块方法时,我都会收到[BadMethodCallException] Method isNotEmpty does not exist
。
我在所有服务器(测试,暂存和生产)上都收到此错误,但在我的本地计算机上却没有,即使所有4台计算机都具有相同版本的php,laravel。
Stacktrace
[2019-02-25 11:51:04]登台。错误:BadMethodCallException:方法isNotEmpty不存在。在/api/bootstrap/cache/compiled.php:6366中 堆栈跟踪:
0 /api/vendor/baopham/dynamodb/src/DynamoDbQueryBuilder.php(430):Illuminate \ Support \ Collection-> __ call('isNotEmpty',Array)
1 /api/app/Console/Commands/IndexInvoicesToElastic.php(142):BaoPham \ DynamoDb \ DynamoDbQueryBuilder-> chunk(10000,Object(Closure))
2 [内部功能]:App \ Console \ Commands \ IndexInvoicesToElastic-> handle()
3 /api/bootstrap/cache/compiled.php(1257):call_user_func_array(Array,Array)
4 /api/vendor/laravel/framework/src/Illuminate/Console/Command.php(169):Illuminate\Container\Container->call(Array)
5 /api/vendor/symfony/console/Command/Command.php(256):Illuminate \ Console \ Command-> execute(Object(Symfony \ Component \ Console \ Input \ ArgvInput),Object(Symfony \ Component \ Console \ Output \ ConsoleOutput))
6 /api/vendor/laravel/framework/src/Illuminate/Console/Command.php(155):Symfony \ Component \ Console \ Command \ Command-> run(Object(Symfony \ Component \ Console \ Input \ ArgvInput),Object (Symfony \ Component \ Console \ Output \ ConsoleOutput))
7 /api/vendor/symfony/console/Application.php(794):Illuminate \ Console \ Command-> run(对象(Symfony \ Component \ Console \ Input \ ArgvInput),对象(Symfony \ Component \ Console \ Output \ ConsoleOutput) ))
8 /api/vendor/symfony/console/Application.php(186):Symfony \ Component \ Console \ Application-> doRunCommand(Object(App \ Console \ Commands \ IndexInvoicesToElastic),Object(Symfony \ Component \ Console \ Input \ ArgvInput ),对象(Symfony \ Component \ Console \ Output \ ConsoleOutput))
9 /api/vendor/symfony/console/Application.php(117):Symfony \ Component \ Console \ Application-> doRun(Object(Symfony \ Component \ Console \ Input \ ArgvInput),Object(Symfony \ Component \ Console \ Output \ ConsoleOutput))
10 /api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107):Symfony \ Component \ Console \ Application-> run(Object(Symfony \ Component \ Console \ Input \ ArgvInput),Object (Symfony \ Component \ Console \ Output \ ConsoleOutput))
11 / api / artisan(35):照亮\ Foundation \ Console \ Kernel-> handle(Object(Symfony \ Component \ Console \ Input \ ArgvInput),Object(Symfony \ Component \ Console \ Output \ ConsoleOutput))
12 {main}
版本信息
Laravel:5.2
答案 0 :(得分:1)
我看不到方法isNotEmpty on Laravel 5.2 collections documentation。 isNotEmpty was introduced on 5.3
答案 1 :(得分:1)
Laravel 5.2 不支持isNotEmpty,它是在 Laravel 5.3 中引入的。但是,为什么不使用这样简单的东西:
// If collection exist
if($yourCollection) {
// your code
} else {
//do something else
}