How to solve Missing argument 3 for Rinvex\Repository\Repositories\BaseRepository::join()?

醉酒当歌 提交于 2019-12-12 05:37:52

问题


I use this : https://github.com/rinvex/repository

My query is like this :

$query = $this->store_repository
    ->join('favorites', function ($join) {
        $join->on('stores.id', '=', 'favorites.favoritable_id')
            ->where('favorites.favoritable_type', 'like', 'App\\\Models\\\Store');
    })
    ->where('stores.status', '=', 1)
    ->select('stores.id', 'stores.name', 'stores.photo','stores.address');

if($location)
    $query->where('stores.address', 'like', "%$location%");

if($q) {
    $query->where('stores.name', 'like', "%$q%")
        ->where('stores.address', 'like', "%$q%", 'or');
}

$result = $query->orderBy('favorites.updated_at', 'desc')->paginate($num);

When executed, there exist error like this :

Missing argument 3 for Rinvex\Repository\Repositories\BaseRepository::join()

How can I solve it?


回答1:


I don't think you need the clojure to make what you want.

I guess this should be fine :

$query = $this->store_repository
    ->join('favorites', '=', 'favorites.favoritable_id')
    ->where('favorites.favoritable_type', 'like', 'App\\\Models\\\Store');
    ->where('stores.status', '=', 1)
    ->select('stores.id', 'stores.name', 'stores.photo','stores.address');


来源:https://stackoverflow.com/questions/43326809/how-to-solve-missing-argument-3-for-rinvex-repository-repositories-baserepositor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!