✅ OrganizationController (index, create, store, show, edit, update, destroy) ✅ OrganizationPolicy (viewAny, view, create, update, delete) ✅ Маршруты: /admin/organizations (resource) ✅ Blade-шаблоны: - admin/organizations/index.blade.php (список с пагинацией) - admin/organizations/create.blade.php (форма создания) - admin/organizations/show.blade.php (просмотр + статистика) - admin/organizations/edit.blade.php (форма редактирования) ✅ Обновлённое меню в dashboard/admin.blade.php Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
43 lines
853 B
PHP
Executable File
43 lines
853 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class TestResponse extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'attempt_id',
|
|
'question_id',
|
|
'answer_id',
|
|
'text_response',
|
|
'matching_response',
|
|
'is_correct',
|
|
'score',
|
|
];
|
|
|
|
protected $casts = [
|
|
'matching_response' => 'array',
|
|
'is_correct' => 'boolean',
|
|
];
|
|
|
|
public function attempt(): BelongsTo
|
|
{
|
|
return $this->belongsTo(TestAttempt::class);
|
|
}
|
|
|
|
public function question(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Question::class);
|
|
}
|
|
|
|
public function answer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Answer::class);
|
|
}
|
|
}
|