Fix: Добавлена организация в элементы заявки
✅ organization relationship в CourseRequestItem ✅ Отображение в show.blade.php ✅ Загрузка в контроллере Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
c6f303fac7
commit
38b2f043bf
|
|
@ -178,7 +178,7 @@ class CourseRequestController extends Controller
|
|||
{
|
||||
Gate::authorize('view', $courseRequest);
|
||||
|
||||
$courseRequest->load(['organization', 'requestedBy', 'approvedBy', 'items.course', 'items.user', 'items.group']);
|
||||
$courseRequest->load(['organization', 'requestedBy', 'approvedBy', 'items.course', 'items.user', 'items.group', 'items.organization']);
|
||||
|
||||
return view('admin.course-requests.show', compact('courseRequest'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ class CourseRequestItem extends Model
|
|||
return $this->belongsTo(Group::class);
|
||||
}
|
||||
|
||||
public function organization(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Organization::class);
|
||||
}
|
||||
|
||||
public function getTypeAttribute(): string
|
||||
{
|
||||
if ($this->user_id) {
|
||||
|
|
|
|||
|
|
@ -95,8 +95,10 @@
|
|||
<span class="badge bg-success"><i class="bi bi-person"></i> Индивидуально</span>
|
||||
@elseif($item->group_id)
|
||||
<span class="badge bg-info"><i class="bi bi-people"></i> Группе</span>
|
||||
@else
|
||||
@elseif($item->organization_id)
|
||||
<span class="badge bg-primary"><i class="bi bi-building"></i> Организации</span>
|
||||
@else
|
||||
<span class="badge bg-secondary"><i class="bi bi-building"></i> Организации заявки</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
|
|
@ -104,6 +106,8 @@
|
|||
{{ $item->user?->name ?? '—' }}
|
||||
@elseif($item->group_id)
|
||||
{{ $item->group?->name ?? '—' }}
|
||||
@elseif($item->organization_id)
|
||||
{{ $item->organization?->name ?? '—' }}
|
||||
@else
|
||||
{{ $courseRequest->organization->name }}
|
||||
@endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue