Ok so i am trying to perform a mysql query to join to tables and return the results.
So in my controller i have an array of serviceIDs that when print_r() looks like this:
Array
(
[0] => 50707
[1] => 50709
)
The name of this array is $serviceIDS
Okay Then i now call a function from one of my models. This is a scope as seen below:
$services = Services::getWatchListInfo($serviceIDS)->get();
This is the scope function in my model:
public function scopegetWatchListInfo($serviceIDS){
$services = DB::table('services')
->join('reviews','services.serviceID','=','reviews.serviceID')
->select('services.name','services.type','services.review_count_approved','reviews.escalate','reviews.average_rating')
->whereIn('serviceID',$serviceIDS);
return $services;
}
Okay so this should get results from both my services and reviews table where service id is in the array.
Instead i am getting the following error.
Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, object given, called in /Users/user/sites/informatics-2/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 311 and defined
Any ideas?