如何从流明 api 中的数据库中获取图像?

How to get image from the database in lumen api?

我已尝试正常获取数据,但在 json 响应中图像字段显示错误。下面的代码是对的??

public function up()
    {
        Schema::create('admin', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username');
            $table->string('password');
            $table->string('profile_pic');  
});

并获取代码下方的数据

public function log() {

        $users = AdminLogin::all();

        return response()->json($users);
    }
$photo = $this->uploadFile->get_by_photo($photo, ['filename']); 
$path = storage_path('app') . '/' . $photo[0]['filename']; 
$type = File::mimeType($path); 
$headers = array('Content-Type' => $type); 
$response = response()->download($path, $photo, $headers); ob_end_clean(); 
return $response;