我从事laravel 5.8项目已经有一段时间了,我对其进行了测试,并且在我的机器上可以正常工作。在部署上,使用toJson()方法响应Ajax请求时,出现500个错误
我尝试运行composer并检查了所有依赖关系,认为这是问题所在,不是问题。 我不想更改代码,因为我以这种方式编写了大量的Json响应,这些响应可以通过我的vue组件完美地处理,修改它会花费太多时间
这是一个使用Json()方法的示例,并且我有很多类似的情况(在这种情况下,Order是具有许多关系的模型):
->where('products.name','like',$data['search'])
->where('products.description','like',$data['search'])
->where('products.note','like',$data['search'])->get();
return $orders->toJson();
这是我收到的错误消息的示例
"message": "Data missing",
"exception": "InvalidArgumentException",
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php",
"line": 563,
"trace": [
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php",
"line": 585,
"function": "rawCreateFromFormat",
"class": "Carbon\\Carbon",
"type": "::"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Support/DateFactory.php",
"line": 216,
"function": "createFromFormat",
"class": "Carbon\\Carbon",
"type": "::"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php",
"line": 237,
"function": "__call",
"class": "Illuminate\\Support\\DateFactory",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php",
"line": 811,
"function": "__callStatic",
"class": "Illuminate\\Support\\Facades\\Facade",
"type": "::"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php",
"line": 131,
"function": "asDateTime",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php",
"line": 93,
"function": "addDateAttributesToArray",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php",
"line": 1088,
"function": "attributesToArray",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php",
"line": 1117,
"function": "toArray",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Support/Collection.php",
"line": 1959,
"function": "jsonSerialize",
"class": "Illuminate\\Database\\Eloquent\\Model",
"type": "->"
},
{
"function": "Illuminate\\Support\\{closure}",
"class": "Illuminate\\Support\\Collection",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Support/Collection.php",
"line": 1967,
"function": "array_map"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Support/Collection.php",
"line": 1978,
"function": "jsonSerialize",
"class": "Illuminate\\Support\\Collection",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/app/Http/Controllers/OrderController.php",
"line": 33,
"function": "toJson",
"class": "Illuminate\\Support\\Collection",
"type": "->"
},
{
"function": "getListJson",
"class": "App\\Http\\Controllers\\OrderController",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
"line": 54,
"function": "call_user_func_array"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
"line": 45,
"function": "callAction",
"class": "Illuminate\\Routing\\Controller",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 219,
"function": "dispatch",
"class": "Illuminate\\Routing\\ControllerDispatcher",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 176,
"function": "runController",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 680,
"function": "run",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 30,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/app/Http/Middleware/IsAdmin.php",
"line": 27,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "App\\Http\\Middleware\\IsAdmin",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
"line": 41,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",
"line": 75,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",
"line": 49,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
"line": 56,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Session\\Middleware\\StartSession",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",
"line": 37,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",
"line": 66,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 104,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 682,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 657,
"function": "runRouteWithinStack",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 623,
"function": "runRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 612,
"function": "dispatchToRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 176,
"function": "dispatch",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 30,
"function": "Illuminate\\Foundation\\Http\\{closure}",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/fideloper/proxy/src/TrustProxies.php",
"line": 57,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Fideloper\\Proxy\\TrustProxies",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
"line": 62,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 104,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 151,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/blidaComputer/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 116,
"function": "sendRequestThroughRouter",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/home/ynkjxrau/Beta.newmoboffice.com/index.php",
"line": 55,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
}
]
```}