查询构建器中的存储类

时间:2019-07-03 11:30:30

标签: ajax laravel laravel-query-builder

我在JSON中有一个Ajax请求,我需要返回文件路径以下载文件。

我得到这样的存储空间:

$attachments = $req->file('files')[$key][0]->storeAs('purchase', $filename);

我已经链接了存储:

php artisan storage:link

在我的控制器中,我执行以下操作:

 $dataAttachments = DB::table('purchase_requests_attachments AS a')
                    ->join('users AS b', 'a.id_usr_add', '=', 'b.id')
                    ->join('purchase_attachments_rules AS c', 'a.id_rule', '=', 'c.id')
                    ->select(DB::RAW(Storage::download('a.file', 'tituloteste')), 'a.id AS id', 'a.id_usr_add AS id_usr', 'b.full_name AS full_name', 'a.id_rule AS id_rule', 'c.description as description', 'a.file AS attachment', 'a.created_at AS created_at')->where('a.id_request', '=', $id_purchase)->get();

原始文件无法返回请求路径。 raw方法似乎无法返回正确的路径。

谢谢!

0 个答案:

没有答案