✅ 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>
48 lines
954 B
PHP
Executable File
48 lines
954 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;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Question extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'test_id',
|
|
'type',
|
|
'question_text',
|
|
'explanation',
|
|
'score',
|
|
'sort_order',
|
|
'is_required',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_required' => 'boolean',
|
|
];
|
|
|
|
public function test(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Test::class);
|
|
}
|
|
|
|
public function answers(): HasMany
|
|
{
|
|
return $this->hasMany(Answer::class);
|
|
}
|
|
|
|
public function matchingPairs(): HasMany
|
|
{
|
|
return $this->hasMany(QuestionMatchingPair::class);
|
|
}
|
|
|
|
public function responses(): HasMany
|
|
{
|
|
return $this->hasMany(TestResponse::class);
|
|
}
|
|
}
|