fixed bug view counter change the update_at, Ignore update time to optimize update time

master
Ayda 5 days ago committed by GitHub
parent 61102f2400
commit 971143fa16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -68,7 +68,9 @@ class ClientController extends Controller
$area = 'post'; $area = 'post';
$title = $post->title; $title = $post->title;
$subtitle = $post->subtitle; $subtitle = $post->subtitle;
$post->increment('view'); $post->withoutTimestamps(function () use ($post) {
$post->increment('view');
});
$breadcrumb = [ $breadcrumb = [
__('Posts') => postsUrl(), __('Posts') => postsUrl(),
$post->mainGroup->name => $post->mainGroup->webUrl(), $post->mainGroup->name => $post->mainGroup->webUrl(),
@ -106,7 +108,9 @@ class ClientController extends Controller
$area = 'gallery'; $area = 'gallery';
$title = $gallery->title; $title = $gallery->title;
$subtitle = \Str::limit(strip_tags($gallery->description), 15); $subtitle = \Str::limit(strip_tags($gallery->description), 15);
$gallery->increment('view'); $gallery->withoutTimestamps(function () use ($gallery) {
$gallery->increment('view');
});
$breadcrumb = [ $breadcrumb = [
__('Galleries') => gallariesUrl(), __('Galleries') => gallariesUrl(),
$gallery->title => null, $gallery->title => null,
@ -312,6 +316,9 @@ class ClientController extends Controller
$breadcrumb[$product->category->parent->name] = $product->category->parent->webUrl(); $breadcrumb[$product->category->parent->name] = $product->category->parent->webUrl();
} }
$breadcrumb[$product->name] = null; $breadcrumb[$product->name] = null;
$product->withoutTimestamps(function () use ($product) {
$product->increment('view');
});
return view('client.product', compact('area', 'product', 'title', 'subtitle', 'breadcrumb')); return view('client.product', compact('area', 'product', 'title', 'subtitle', 'breadcrumb'));
} }

Loading…
Cancel
Save