mgsmus hocam HomeController.php da ItemsViews::createViewLog($item); bu şekilde kullanıyorum
bu söylediğinizi createViewLog($item) olarak fonksiyonun içine mi yazıcam?
public function show($id, $slug)
{
$item = Items::whereHas('category', function ($query) {
if(Auth::check()){
$userPoints = Auth::user()->total_point_count(); // if you are logged in, assign points to the current user
} else {
$userPoints = 0; // if he is a guest he awards 0 points
}
$query->where('score', '<=', $userPoints);
$query->where('status', 1);
})->where('id', $id)
->where('slug', $slug)
->where('status', 1)
->firstOrFail();
ItemsViews::createViewLog($item);
// for Top User Widget
$topUser = User::withSum('user_points_list', 'score')
->orderByDesc('user_points_list_sum_score')
->limit(5)
->get();
return view('layouts.item.show')->with([
'site_name' => Settings::find('site_name')->value,
'site_description' => Settings::find('site_description')->value,
'page_name' => Str::limit($item->title, 30),
'categories' => $this->categories,
'pages' => $this->pages,
'status_write' => Settings::find('active_upload')->value,
'randomItems' => $this->itemsRandomOrder,
'item' => $item,
'setting_adv_top' => Settings::find('adv_top')->value,
'setting_adv_bottom' => Settings::find('adv_bottom')->value,
'adv_top' => Advertising::where('id', Settings::find('adv_top')->value)->first(),
'adv_bottom' => Advertising::where('id', Settings::find('adv_bottom')->value)->first(),
'statusPoints' => Settings::find('status_points')->value,
'topUser' => $topUser
]);
}