Betmen35 Önce rotaya bir isim vereceksiniz:
Route::get('home/{myid}', HomeController::class)->name('myhome');
Sonra
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;
View::composer('*', function($view) {
if(Route::currentRouteName() === 'myhome') {
$comments = Comment::where('post_id', Request::route('myid'))
->get();
$view->with('__comments', $comments);
}
});