public function scopeIsVerifiedForComponent(Builder $query, $component_id)
    {
        return $query->select('subscriptions.*')
            ->join('subscribers', 'subscriptions.subscriber_id', '=', 'subscribers.id')
            ->where(function ($query) {
                $query->where('subscriptions.component_id', '=', $component_id)
                    ->orWhere('subscribers.global');
            })
            ->whereNotNull('subscribers.verified_at');
    }
public function scopeIsVerifiedForComponent(Builder $query, $component_id)
    {
        return $query->select('subscriptions.*')
            ->join('subscribers', 'subscriptions.subscriber_id', '=', 'subscribers.id')
            ->where(function ($query) {
                $query->where('subscriptions.component_id', '=', $component_id)
                    ->orWhere('subscribers.global');
            })
            ->whereNotNull('subscribers.verified_at');
    }
public function scopeIsVerifiedForComponent ( Builder $ query , $ component_id ) { return $ query -> select ( 'subscriptions.*' ) -> join ( 'subscribers' , 'subscriptions.subscriber_id' , '=' , 'subscribers.id' ) -> where ( function ( $ query ) { $ query -> where ( 'subscriptions.component_id' , '=' , $ component_id ) -> orWhere ( 'subscribers.global' ) ; } ) -> whereNotNull ( 'subscribers.verified_at' ) ; }
Finds all verified subscriptions for a component.

@param \Illuminate\Database\Eloquent\Builder $query
@param int                                   $component_id

@return \Illuminate\Database\Eloquent\Builder
Finds all verified subscriptions for a component .