Asked by: Hillcow
I have the following code in a Laravel controller, but the given parameter variable $idea is undefined in the 'whereIn' function. How can I access $idea there? Thank you!
public static function getIdea($idea = null) {
if ($idea != "") {
return DB::table('test')->select('foo')
->whereIn('bar', function($query)
{
$query->select('foobar')
->from('bar2')
->where('foo2', '=', $idea)
->get();
})
->get();
}
}
No comments:
Post a Comment