Answer the question
In order to leave comments, you need to log in
Laravel 8: How to fix a white screen on one of the site pages?
Hi all. Recently started learning Laravel. I made an elementary site that displays a list of posts. It is possible to edit the post and delete it. So on the page that displays the post deletion confirmation form, I just get a "white screen" without errors, without anything. I haven't been able to fix it for 3 hours now. I will be very grateful for your help.
The output route of the deletion confirmation form and the deletion of the post itself:
Route::get('/home/{bb}/delete', [\App\Http\Controllers\HomeController::class, 'showDeleteBbForm'])
->name('bb.delete');
Route::delete('/home/{bb}', [\App\Http\Controllers\HomeController::class, 'destroyBb'])
->name('bb.destroy');
public function showDeleteBbForm(Bb $bb)
{
return view('bb_delete', ['bb' => $bb]);
}
public function destroyBb(Bb $bb)
{
$bb->delete();
return redirect()->route('home');
}
@extends('layouts.base')
@section('title', 'My posts')
@section('main')
<p class="text-right"><a href="{{ route('bb.add') }}"> Add posts</a></p>
@if(count($bbs) > 0)
<table class="table table-striped">
<thead>
<tr>
<th>Product</th>
<th>Price</th>
<th colspan="2"> </th>
</tr>
</thead>
<tbody>
@foreach($bbs as $bb)
<tr>
<td><h3>{{ $bb->title }}</h3></td>
<td>{{ $bb->price }}</td>
<td>
<a href="{{ route('bb.edit', ['bb' => $bb->id]) }}">Edit</a>
<a href="{{ route('bb.delete', ['bb' => $bb->id]) }}">Delete</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@endsection
@section('title', 'Delete posts :: My posts')
@section('main')
<h2>{{ $bb->title }}</h2>
<p>{{ $bb->content }}</p>
<p>{{ $bb->price }} UAH</p>
<p> Author: {{ $bb->user->name }} </p>
<form action="{{ route('bb.destroy', ['bb' => $bb->id]) }}"
method="POST">
@csrf
@method('DELETE')
<input type="submit" class="btn btn-danger" value="Delete">
</form>
@endsection('main')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question