finished the upgrade to filament 4. completely revamped the frontend with codex, now it looks great!

This commit is contained in:
2025-11-13 17:42:43 +01:00
parent f59fda588b
commit b311188bc1
138 changed files with 5440 additions and 4105 deletions

View File

@@ -2,12 +2,15 @@
namespace App\Http\Controllers;
use App\Services\PrinterService;
use App\Settings\GeneralSettings;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use App\Services\PrinterService;
class PrintController extends Controller
{
public function __construct(private GeneralSettings $settings) {}
public function printImage(Request $request, PrinterService $printerService)
{
$request->validate([
@@ -17,21 +20,20 @@ class PrintController extends Controller
$imagePath = public_path(str_replace(url('/'), '', $request->input('image_path')));
$quantity = $request->input('quantity');
// Retrieve printer name from global settings using standard Eloquent
$printerName = \App\Models\Setting::where('key', 'selected_printer')->value('value');
if (!$printerName) {
Log::error("PrintController: Default printer name not found in settings.");
$printerName = $this->settings->selected_printer === '__custom__'
? $this->settings->custom_printer_address
: $this->settings->selected_printer;
if (! $printerName) {
Log::error('PrintController: Default printer name not found in settings.');
return response()->json(['error' => 'Default printer not configured.'], 500);
}
if (!$printerName) {
Log::error("PrintController: Default printer name not found in settings.");
return response()->json(['error' => 'Default printer not configured.'], 500);
}
if (!file_exists($imagePath)) {
if (! file_exists($imagePath)) {
Log::error("PrintController: Image file not found at {$imagePath}");
return response()->json(['error' => 'Image file not found.'], 404);
}
@@ -39,9 +41,11 @@ class PrintController extends Controller
if ($printSuccess) {
Log::info("PrintController: Successfully sent print command for {$imagePath} (x{$quantity}) to {$printerName}");
return response()->json(['message' => 'Print command sent successfully.']);
} else {
Log::error("PrintController: Failed to send print command for {$imagePath} (x{$quantity}) to {$printerName}");
return response()->json(['error' => 'Failed to send print command.'], 500);
}
}