2017-04-10 93 views
0

我用這個:https://github.com/rinvex/repository如何解決缺少Rinvex Repository Repositories BaseRepository :: join()的參數3?

我的查詢是這樣的:

$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); 

執行時,存在誤差是這樣的:

缺少論據3 Rinvex \庫\庫\ BaseRepository :: join()

我該如何解決它?

+0

添加缺少的參數。 – JustOnUnderMillions

+0

@JustOnUnderMillions,哪裏缺少參數? –

+0

我找不到任何有關'join()'方法的git repo文檔。這個文件在哪裏? – Joe

回答

0

我不認爲你需要clojure來製作你想要的東西。

我想這應該是罰款:

$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'); 
相關問題