fix: client service/complaints 500 修复

This commit is contained in:
li
2026-03-14 23:21:15 +08:00
parent a163ac1766
commit a29faa3b47
2 changed files with 3 additions and 4 deletions
@@ -35,7 +35,7 @@ class ComplaintController extends Controller
$customer = $request->user();
$validated = $request->validate([
'type' => 'required|string|max:50',
'type' => 'required|integer|in:1,2,3,4',
'content' => 'required|string|max:1000',
'images' => 'nullable|array',
'images.*' => 'nullable|string|max:500',
@@ -44,7 +44,7 @@ class ComplaintController extends Controller
$complaint = Complaint::create([
'customer_id' => $customer->id,
'store_id' => $customer->store_id,
'type' => $validated['type'],
'type' => (int) $validated['type'],
'content' => $validated['content'],
'images' => $validated['images'] ?? null,
'status' => 1,
@@ -20,8 +20,7 @@ class ServiceController extends Controller
$customer = $request->user();
$query = ServiceOrder::withoutGlobalScope('store')
->where('customer_id', $customer->id)
->with('package:id,name', 'item:id,name');
->where('customer_id', $customer->id);
if ($request->filled('status')) {
$query->where('status', (int) $request->input('status'));