mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-17 15:52:15 +00:00
controller refactoring part 21
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace Domain\Files\Controllers;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Support\Services\HelperService;
|
||||
use Domain\Files\Resources\FileResource;
|
||||
|
||||
/**
|
||||
* Get shared file record
|
||||
*/
|
||||
class VisitorGetSingleFileInfoController
|
||||
{
|
||||
public function __construct(
|
||||
public HelperService $helper,
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke(
|
||||
Share $shared
|
||||
): Response {
|
||||
// Check ability to access protected share files
|
||||
$this->helper->check_protected_share_record($shared);
|
||||
|
||||
// Get file
|
||||
$file = File::whereUserId($shared->user_id)
|
||||
->whereId($shared->item_id)
|
||||
->firstOrFail();
|
||||
|
||||
// Set access urls
|
||||
$file->setPublicUrl($shared->token);
|
||||
|
||||
return response(new FileResource($file), 200);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user