file route for template generation
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\File\FileService;
|
||||
use Lucent\File\ImageService;
|
||||
use Lucent\Query\Query;
|
||||
use Lucent\Record\InputData\RecordInputData;
|
||||
use Lucent\Record\RecordService;
|
||||
@@ -22,11 +23,23 @@ class FileController extends Controller
|
||||
private readonly ChannelService $channelService,
|
||||
private readonly RecordService $recordService,
|
||||
private readonly FileService $fileService,
|
||||
private readonly ImageService $imageService,
|
||||
private readonly Query $query
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function template(Request $request)
|
||||
{
|
||||
$template = $request->segment(3);
|
||||
$templatePath = $request->route("any");
|
||||
$filePath = str_replace($template."/", "", $templatePath);
|
||||
$record = $this->query->filter(["_file.path" => $filePath])->run()->records->first();
|
||||
$this->imageService->file($record,$template);
|
||||
$disk = $this->fileService->loadDisk();
|
||||
return response()->file($disk->path("templates/".$templatePath));
|
||||
}
|
||||
|
||||
public function download(Request $request)
|
||||
{
|
||||
$disk = $this->fileService->loadDisk();
|
||||
|
||||
Reference in New Issue
Block a user