kodeine/laravel-meta

scopeMeta should use $this->getTable() instead of $this->table

eswinfen opened this issue · 7 comments

The scopeMeta function uses the table member $this->table, which is only set if there is an explicit override of the table name on a model. Instead it should use the $this->getTable() method and getQualifiedKeyName() method.

If the scopeMeta method is altered as follows it should work in all cases:

public function scopeMeta($query)
{
        return $query->join($this->getTable(), $this->getQualifiedKeyName(), '=', $this->getMetaTable().$this->getMetaKeyName())
            ->select($this->getTable().'.*');
}

@eswinfen can you please propose a PR for this?

@necenzurat can you please post a PR as well?

Thanks

due to the lack of inactivity, I thought you where dead and made a fork

+1
I get Base table or view not found

@necenzurat please post a PR and i'll merge it right away

@kodeine no, i cannot, because i did not Github Fork your repo.

fixed.