I am new to laravel, I was not able to find solution this error with any searches. after deploy to Heroku it was show up this error.
this is views/bbs/index.blade.php
<tbody id="tbl">
@foreach ($posts as $post)
<tr>
<td>{{ optional ($post)->id }}</td>
<td>{{ optional ($post->category)->name }}</td>
<td>{{ optional ($post->created_at)->format('Y.m.d') }}</td>
<td>{{ optional ($post)->name }}</td>
<td>{{ optional ($post)->subject }}</td>
<td>{!! nl2br(e(Str::limit($post->message, 100))) !!}
@if ($post->comments->count() >= 1)
<p><span class="badge badge-primary">コメント:{{ optional ($post->comments)->count() }}件</span></p>
@endif
</td>
<td class="text-nowrap">
<p><a href="" class="btn btn-primary btn-sm">詳細</a></p>
<p><a href="" class="btn btn-info btn-sm">編集</a></p>
<p><a href="" class="btn btn-danger btn-sm">削除</a></p>
</td>
</tr>
@endforeach
</tbody>
this is PostsController.php
use Illuminate\Http\Request;
use App\Post;
class PostsController extends Controller{
public function index()
{
$posts = Post::orderBy('created_at', 'DESC')->get();
return view('bbs.index', ['posts' => $posts]);
}}
this is route
Route::get('/', function () {
return view('bbs.index');});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('bbs', 'PostsController@index')
please help in this queries.