Feat: Moving File Handling To Core

This commit is contained in:
2026-09-25 13:47:58 +03:00
parent 540da1af24
commit a51e9456d6
11 changed files with 134 additions and 218 deletions
-7
View File
@@ -2,7 +2,6 @@
use App\Http\Controllers\Checkout\CartController;
use App\Http\Controllers\Checkout\CheckoutController;
use App\Http\Controllers\Checkout\CustomFieldFileController;
use Illuminate\Support\Facades\Route;
/*
@@ -53,12 +52,6 @@
->whereNumber('line')
->name('checkout.cart.remove');
// A line's custom-field file (e.g. the shopper's photo) — signed,
// temporary URLs only; see CustomFieldFileController.
Route::get('cart/custom-field-file', CustomFieldFileController::class)
->middleware('signed')
->name('checkout.custom-field-file');
Route::post('cart/coupon', [CartController::class, 'applyCoupon'])
->name('checkout.cart.coupon.apply');
+5 -2
View File
@@ -1,5 +1,6 @@
<?php
use App\Http\Controllers\CustomFieldUploadController;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
@@ -9,5 +10,7 @@
})->purpose('Display an inspiring quote');
// Deletes custom-field photo uploads (CustomFieldUploadController) older than
// 24h that no cart or order line references — see PruneCustomFieldUploads.
Schedule::command('custom-fields:prune-uploads')->dailyAt('04:00');
// 24h that no cart or order line references — boboko-core's generic
// Modules\Core\File\Commands\PruneUnownedFilesCommand, scoped to this
// upload flow's own purpose tag.
Schedule::command('boboko:file:prune-unowned', [CustomFieldUploadController::PURPOSE])->dailyAt('04:00');
+12 -7
View File
@@ -24,6 +24,18 @@
// redirects a request with no matching locale segment first.
Route::get('/', [HomeController::class, 'index'])->middleware('locale');
// No {locale} prefix: the response is plain JSON with no locale-dependent
// content, and boboko-core's Modules\Core\File\Http\Controllers\
// UploadFileController::store() (which CustomFieldUploadController
// extends) has no concept of a locale route parameter at all — every
// other action in the group below still needs $locale as its literal
// first parameter (the ControllerDispatcher positional-args gotcha), so
// this one route living outside the group avoids that entirely rather
// than forcing this shared, locale-agnostic base class to accept one.
Route::post('/custom-field-uploads', [CustomFieldUploadController::class, 'store'])
->middleware('throttle:20,1')
->name('custom-field-upload.store');
Route::prefix('{locale}')
->middleware('locale')
->group(function () {
@@ -39,13 +51,6 @@
'product.stock-check',
);
// Photo for a product custom field, uploaded as soon as it's picked —
// see CustomFieldUploadController. Throttled: it writes to disk and
// needs no cart/session to call.
Route::post('/custom-field-uploads', [CustomFieldUploadController::class, 'store'])
->middleware('throttle:20,1')
->name('custom-field-upload.store');
Route::post('/products/{product}/reviews', [ProductController::class, 'storeReview'])->name(
'product.reviews.store',
);