protected function scopeQueryToWhereModelIsMissing($query, $modelName)
    {
        $model = new $modelName;
        $table = $this->abilitiesTable();

        $query->where("{$table}.entity_type", $modelName);

        $query->whereNotIn("{$table}.entity_id", function ($query) use ($modelName) {
            $model = new $modelName;
            $table = $model->getTable();

            $query->from($table)->select($table.'.'.$model->getKeyName());
        });
    }