file route for template generation
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Lucent\Channel\ChannelService;
|
use Lucent\Channel\ChannelService;
|
||||||
use Lucent\File\FileService;
|
use Lucent\File\FileService;
|
||||||
|
use Lucent\File\ImageService;
|
||||||
use Lucent\Query\Query;
|
use Lucent\Query\Query;
|
||||||
use Lucent\Record\InputData\RecordInputData;
|
use Lucent\Record\InputData\RecordInputData;
|
||||||
use Lucent\Record\RecordService;
|
use Lucent\Record\RecordService;
|
||||||
@@ -22,11 +23,23 @@ class FileController extends Controller
|
|||||||
private readonly ChannelService $channelService,
|
private readonly ChannelService $channelService,
|
||||||
private readonly RecordService $recordService,
|
private readonly RecordService $recordService,
|
||||||
private readonly FileService $fileService,
|
private readonly FileService $fileService,
|
||||||
|
private readonly ImageService $imageService,
|
||||||
private readonly Query $query
|
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)
|
public function download(Request $request)
|
||||||
{
|
{
|
||||||
$disk = $this->fileService->loadDisk();
|
$disk = $this->fileService->loadDisk();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use Lucent\Http\Controller\SetupController;
|
|||||||
|
|
||||||
|
|
||||||
Route::get('/lucent/setup', [SetupController::class, 'setup']);
|
Route::get('/lucent/setup', [SetupController::class, 'setup']);
|
||||||
|
Route::get('/storage/templates/{any}', [FileController::class, 'template'])->where('any', '.*');
|
||||||
|
|
||||||
Route::group([
|
Route::group([
|
||||||
'middleware' => ['web'],
|
'middleware' => ['web'],
|
||||||
|
|||||||
Reference in New Issue
Block a user