Fix: Организация берётся из items_json

 organization_id из первого элемента items
 Удалена валидация organization_id
 index.blade.php обрабатывает NULL organization

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mirivlad 2026-04-02 09:22:12 +08:00
parent 6833441514
commit b01d8431c8
2 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,6 @@ class CourseRequestController extends Controller
Gate::authorize('create', CourseRequest::class);
$validated = $request->validate([
'organization_id' => 'nullable|exists:organizations,id',
'status' => 'nullable|in:pending,approved,rejected',
'note' => 'nullable|string',
'items_json' => 'required|string',
@ -81,8 +80,9 @@ class CourseRequestController extends Controller
DB::beginTransaction();
try {
// Определяем организацию из первого элемента или общую
$organizationId = $validated['organization_id'] ?? null;
// Берём organization_id из первого элемента или null
$firstItem = reset($items);
$organizationId = $firstItem['organization_id'] ?? null;
// Создаём заявку
$courseRequest = CourseRequest::create([

View File

@ -55,7 +55,7 @@
<tbody>
@forelse($requests as $request)
<tr>
<td><strong>{{ $request->organization->name }}</strong></td>
<td><strong>{{ $request->organization?->name ?? 'Без организации' }}</strong></td>
<td>
@if($request->isPending())
<span class="badge bg-warning">Ожидает</span>