首页 > 解决方案 > 数据库外观返回“传递给 Symfony\Component\HttpFoundation\Response::setContent() 的参数 1 必须是字符串类型或 null,给定对象”

问题描述

我需要从我的 LeadRepository 类中显示一个潜在客户注册。

   use Illuminate\Support\Facades\DB;

   public function show(Lead $lead)
    {
        try {
            return DB::table('leads')->find($lead->id);
        } catch (Exception $exception) {
            return $this->exceptionJson($exception);
        }
    }

但我得到的只是这个错误:

TypeError: Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() must be of the type string or null, object given, called in C:\xampp\htdocs\novosimuladornewsun\api\vendor\laravel\framework\src\Illuminate\Http\Response.php on line 72 in file C:\xampp\htdocs\novosimuladornewsun\api\vendor\symfony\http-foundation\Response.php on line 412

标签: databaselaravelfacadesymfony-http-foundation

解决方案


推荐阅读