laravel-admin 表格搜索条件,怎么跨库查询

1. 运行环境

1). 当前使用的 Laravel 版本?

7.30.6
//: <> (使用 php artisan --version 命令查看)

2). 当前使用的 php/php-fpm 版本?

PHP 版本:7.4.30
//: <> (使用 php --version 命令查看 php 版本)

php-fpm 版本:

3). 当前系统

4). 业务环境

5). 相关软件版本

2. 问题描述?

laravel-admin 使用gird filter添加表格搜索条件,但是需要跨库查询,使用gpt的代码会报错

Laravel

3. 您期望得到的结果?

4. 您实际得到的结果?

ErrorException In Model.php line 348 :
call_user_func_array() expects parameter 1 to be a valid callback, second array member is not a valid method

#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()

#1 /data/www/test/vendor/encore/laravel-admin/src/Grid/Model.php(348): call_user_func_array()

#2 /data/www/test/vendor/encore/laravel-admin/src/Grid/Filter.php(521): Encore\Admin\Grid\Model->addConditions()

#3 /data/www/test/vendor/encore/laravel-admin/src/Grid/Concerns/HasFilter.php(65): Encore\Admin\Grid\Filter->execute()

#4 /data/www/test/vendor/encore/laravel-admin/src/Grid.php(561): Encore\Admin\Grid->applyFilter()

#5 /data/www/test/vendor/encore/laravel-admin/src/Grid.php(930): Encore\Admin\Grid->build()

#6 /data/www/test/vendor/encore/laravel-admin/src/Layout/Column.php(100): Encore\Admin\Grid->render()

#7 /data/www/test/vendor/encore/laravel-admin/src/Layout/Row.php(80): Encore\Admin\Layout\Column->build()

#8 /data/www/test/vendor/encore/laravel-admin/src/Layout/Content.php(215): Encore\Admin\Layout\Row->build()

#9 /data/www/test/vendor/encore/laravel-admin/src/Layout/Content.php(308): Encore\Admin\Layout\Content->build()

#10 /data/www/test/vendor/laravel/framework/src/Illuminate/Http/Response.php(62): Encore\Admin\Layout\Content->render()

#11 /data/www/test/vendor/laravel/framework/src/Illuminate/Http/Response.php(34): Illuminate\Http\Response->setContent()

#12 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(759): Illuminate\Http\Response->__construct()

#13 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(731): Illuminate\Routing\Router::toResponse()

#14 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(685): Illuminate\Routing\Router->prepareResponse()

#15 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing{closure}()

#16 /data/www/test/vendor/encore/laravel-admin/src/Middleware/Permission.php(46): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#17 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Encore\Admin\Middleware\Permission->handle()

#18 /data/www/test/vendor/encore/laravel-admin/src/Middleware/Bootstrap.php(15): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#19 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Encore\Admin\Middleware\Bootstrap->handle()

#20 /data/www/test/vendor/encore/laravel-admin/src/Middleware/LogOperation.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#21 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Encore\Admin\Middleware\LogOperation->handle()

#22 /data/www/test/vendor/encore/laravel-admin/src/Middleware/Pjax.php(24): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#23 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Encore\Admin\Middleware\Pjax->handle()

#24 /data/www/test/vendor/encore/laravel-admin/src/Middleware/Authenticate.php(28): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#25 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Encore\Admin\Middleware\Authenticate->handle()

#26 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#27 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle()

#28 /data/www/test/app/Http/Middleware/VerifyCsrfToken.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#29 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\VerifyCsrfToken->handle()

#30 /data/www/test/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#31 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle()

#32 /data/www/test/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#33 /data/www/test/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()

#34 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle()

#35 /data/www/test/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#36 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()

#37 /data/www/test/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#38 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle()

#39 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#40 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(687): Illuminate\Pipeline\Pipeline->then()

#41 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\Routing\Router->runRouteWithinStack()

#42 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(628): Illuminate\Routing\Router->runRoute()

#43 /data/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(617): Illuminate\Routing\Router->dispatchToRoute()

#44 /data/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\Routing\Router->dispatch()

#45 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}()

#46 /data/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#47 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()

#48 /data/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#49 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()

#50 /data/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#51 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()

#52 /data/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#53 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()

#54 /data/www/test/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#55 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle()

#56 /data/www/test/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#57 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle()

#58 /data/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()

#59 /data/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\Pipeline\Pipeline->then()

#60 /data/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(109): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()

#61 /data/www/test/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle()

#62 {main}

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 1

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!