src/Repository/StackRepository.php
protected function count($builder)
    {
        $read = NotificationsStackRead::select(['stack_id'])->withTrashed()->where('user_id', user()->id)->pluck('stack_id');
        return $builder->whereNotIn('id', $read)->count();
    }
protected function count($builder)
    {
        $read = NotificationsStackRead::select(['stack_id'])->withTrashed()->where('user_id', user()->id)->pluck('stack_id');
        return $builder->whereNotIn('id', $read)->count();
    }
protected function count ( $ builder ) { $ read = NotificationsStackRead :: select ( [ 'stack_id' ] ) -> withTrashed ( ) -> where ( 'user_id' , user ( ) -> id ) -> pluck ( 'stack_id' ) ; return $ builder -> whereNotIn ( 'id' , $ read ) -> count ( ) ; }
Assign counter query

@param \Illuminate\Database\Query\Builder $builder
@return \Illuminate\Database\Eloquent\Model
Assign counter query