@extends('admin.layouts.app') @section('title', 'إدارة الأسئلة') @section('content')

إدارة الأسئلة

إضافة وتعديل وحذف أسئلة التطبيق

إضافة سؤال جديد
مسح
قائمة الأسئلة ({{ $questions->total() }})
@if(request()->hasAny(['search', 'category'])) مفلترة @endif
@if($questions->count() > 0)
@foreach($questions as $question) @endforeach
# نص السؤال الفئة نوع السؤال عدد الخيارات تاريخ الإنشاء الإجراءات
{{ $question->id }}
{{ Str::limit($question->question_text, 80) }}
{{ $question->category->name ?? 'غير محدد' }} @php // ✅ إصلاح: التعامل مع options سواء كانت array أو JSON string $optionsData = $question->options; $hasOptions = false; $optionsCount = 0; if (!empty($optionsData)) { // إذا كانت string، حولها لـ array if (is_string($optionsData)) { $decoded = json_decode($optionsData, true); if (is_array($decoded)) { $optionsData = $decoded; $hasOptions = true; $optionsCount = count($optionsData); } } // إذا كانت array بالفعل (بسبب cast في Model) elseif (is_array($optionsData)) { $hasOptions = true; $optionsCount = count($optionsData); } } @endphp {{ $hasOptions ? 'اختيار متعدد' : 'نص مفتوح' }} @if($hasOptions) {{ $optionsCount }} @else - @endif {{ $question->created_at->format('Y/m/d') }}
@if($questions->hasPages())
{{ $questions->withQueryString()->links() }}
@endif @else

لا توجد أسئلة

@if(request()->hasAny(['search', 'category'])) لم يتم العثور على أسئلة مطابقة لمعايير البحث @else ابدأ بإضافة أول سؤال للتطبيق @endif

إضافة أول سؤال
@endif
@endsection @push('scripts') @endpush