Error ErrorException: Undefined variable: request in file always appears, even though I have defined it as below
public function postlog_show(Request $request)
{
$log = $request->log;
$userlocation = Auth::user()->location;
$postlocations = Postlocation::orderBy('id', 'DESC')->where('location', $userlocation)
->whereHas('postlognya', function (Builder $query) {
$query->where('log', 'like', '%' . $request->log . '%');
})
->get();
return view('front.postlog2')
->with('postlocations', $postlocations)
;
}