Laravel forbids direct access to files in a directory under storage

for example, I have such a file / storage/app/public/report/1/14.pdf, in the laravel project through the php artisan storage:link command, which can be accessed directly using http://domain/storage/report/., but because of the particularity of this pdf, it can only be seen by this user. For example, if my user id is 1 (corresponding to parameter 1 after report), then I can read 14.pdf. If my user id is 2, then I can"t read this file. How should I implement it?
I may want to be similar to this result. Instead of using the method of accessing files directly, such as http://domain/storage/report/., you must access pdf files through http://domain/report/1/14

.
Mar.17,2021

you can return download response in the controller corresponding to report route

response ()-> download (storage_path ('app/public/report/1/14.pdf'));

)
Menu