storage and image model

This commit is contained in:
2024-09-27 14:28:20 +03:00
parent 6d15591601
commit 63232585ab
7 changed files with 33 additions and 120 deletions
+1 -13
View File
@@ -23,25 +23,13 @@ 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();
$schema = $this->channelService->getSchema($record->schema);
$this->imageService->file($record,$template);
$disk = $this->fileService->loadDisk($schema->disk);
return response()->file($disk->path("templates/".$templatePath));
}
public function original(Request $request, string $disk)
public function fromDisk(Request $request, string $disk)
{
$imagePath = $request->route("any");
$disk = $this->fileService->loadDisk($disk);
+2 -3
View File
@@ -14,9 +14,8 @@ use Lucent\Http\Controller\SetupController;
Route::get('/lucent/setup', [SetupController::class, 'setup']);
Route::get('/storage/templates/{any}', [FileController::class, 'template'])->where('any', '.*');
Route::get('/lfs-{disk}/thumbs/{any}', [FileController::class, 'thumb'])->where('any', '.*');
Route::get('/lfs-{disk}/{disk}/{any}', [FileController::class, 'original'])->where('any', '.*');
Route::get('/lfs-{disk}/{any}', [FileController::class, 'fromDisk'])->where('any', '.*');
Route::group([
'middleware' => ['web'],