Files
hub/app/Http/Controllers/StorageTestController.php
Kelly 32fd2b0ab8 feat: migrate product edit page to new top header layout
- Replace sidebar layout with top header design
- Add product image thumbnail, badges (Active/Featured), and action buttons
- Implement real-time badge toggling with inline JavaScript
- Add one-active-product-per-brand validation with force-activate option
- Standardize checkbox styling with DaisyUI components
- Update terminology from "Default" to "Primary" for images
- Add new models: ProductLine, ProductPackaging, Unit
- Add product line management and image sorting
- Add styling rules to CLAUDE.md for consistency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 23:41:37 -07:00

64 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Traits\FileStorageHelper;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class StorageTestController extends Controller
{
use FileStorageHelper;
/**
* Test storage configuration
*/
public function test(Request $request)
{
$results = [];
$results['storage_info'] = $this->getStorageInfo();
// Test file upload if provided
if ($request->hasFile('test_file')) {
try {
$file = $request->file('test_file');
// Store test file
$path = $this->storeFile($file, 'tests');
$results['upload'] = [
'success' => true,
'path' => $path,
'url' => $this->getFileUrl($path),
];
// Verify file exists
$disk = Storage::disk($this->getStorageDisk());
$results['verification'] = [
'exists' => $disk->exists($path),
'size' => $disk->size($path),
];
// Delete test file
$deleted = $this->deleteFile($path);
$results['cleanup'] = [
'deleted' => $deleted,
'still_exists' => $disk->exists($path),
];
} catch (\Exception $e) {
$results['error'] = $e->getMessage();
}
}
return response()->json($results, 200, [], JSON_PRETTY_PRINT);
}
/**
* Show test upload form
*/
public function form()
{
return view('storage-test');
}
}