Herkese merhabalar bu hatayı düzeltmeme yardımcı olur musunuz acaba
Error
Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames
böyle bir hatayla karşılaştım az önce bütün döngülerimi sonsuz döngü olarak algılıyor ve controllerdaki
Controllerda hata Döndürdüğü satır da bu dün çalışan bir kodu bugün çalıştırmıyor
public function index(Question $question)
{
$options=$question->options()->paginate(10);
return view('admin.option.index', [
'question' => $question,
'options' => $options,
]);
}
options migrate:
public function up()
{
Schema::create('options', function (Blueprint $table) {
$table->id();
$table->foreignId('question_id')->constrained()->onDelete('cascade');;
$table->string('option')->nullable();
$table->timestamps();
});
}
question migrate:
public function up()
{
Schema::create('questions', function (Blueprint $table) {
$table->id();
$table->string('question');
$table->timestamps();
});
}
Hata verdiği Döngüler:
İndex.blade.php/option:
@foreach($options as $option)
<tr>
<td>{{ $option->id }}</td>
<td>{{ $option->question_id }}</td>
<td>{{ $option->option }}</td>
<td>
<a href="{{ route('question.option.edit',[$question,$option]) }}" class="btn btn-primary btn-lg " tabindex="-1" role="button" aria-disabled="true">Düzenle</a>
</td>
<td>
<form action="{{ route('question.option.destroy', [$question,$option]) }}" method="post">
@csrf
@method('delete')
<button title="submit" class="btn btn-danger btn-lg " tabindex="-1" role="button" aria-disabled="true">Sil</button>
</form>
</td>
@endforeach
index.blade.php/question:
@foreach ($questions as $question )
<tr>
<td>{{ $question->id }}</td>
<td>{{ $question->question }}</td>
<td>
@foreach ($question->options as $option)
{{ $option->option}}
@endforeach
</td>
<td>
<a href="{{ route('question.option.index' ,$question) }}" class="btn btn-primary btn-lg " tabindex="-1" role="button" aria-disabled="true">Projeler</a>
</td>
<td class="text-nowrap">
<a href="{{ route('question.show',$question) }}" class="btn btn-sm btn-info">
<i class="fas fa-eye"></i>
<span class="d-none d-sm-inline">{{ __('View') }}</span>
</a>
<a href="{{ route('question.edit',$question) }}" class="btn btn-sm btn-success">
<i class="fas fa-pen"></i>
<span class="d-none d-md-inline">{{ __('Edit') }}</span>
</a>
<form action="{{ route('question.destroy',$question) }}" method="post" class="d-inline-block">
@csrf
@method('delete')
<button class="btn btn-sm btn-danger">
<i class="fas fa-trash"></i>
<span class="d-none d-md-inline">{{ __('Sil') }}</span>
</button>
</form>
</td>
</tr>