app/Notification.php
/**
     * scope to get both private and public notifications for a user
     * @param Builder $query
     * @return
     */
scope to get both private and public notifications for a user
@param Builder $query
@return
scope to get both private and public notifications for a user @param Builder $query @return
public function scopePublicAndPrivate(Builder $query)
    {
        $user = JWTAuth::parseToken()->authenticate();
        if ($user->hasPermissionTo('view_admin_notifications')) {
            return $this->public($query)
                ->union($this->private($query))
                ->union($this->admin($query));
        }
        return $this->public($query)
            ->union($this->private($query));
    }
public function scopePublicAndPrivate ( Builder $ query ) { $ user = JWTAuth :: parseToken ( ) -> authenticate ( ) ; if ( $ user -> hasPermissionTo ( 'view_admin_notifications' ) ) { return $ this -> public ( $ query ) -> union ( $ this -> private ( $ query ) ) -> union ( $ this -> admin ( $ query ) ) ; } return $ this -> public ( $ query ) -> union ( $ this -> private ( $ query ) ) ; }
scope to get both private and public notifications for a user
 @param Builder $query
 @return
scope to get both private and public notifications for a user @param Builder $query @return
//or just view all. i.e where is_public == 0 //return $query;