Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected $appends = ['views'];
- public function getViewsAttribute()
- {
- return $this->views()->count();
- }
- @foreach($posts as $post)
- Views: {{ $post->views }} {{ trans_choice('trans.views', $post->views)
- @endforeach
Add Comment
Please, Sign In to add comment