Laravel 4 - 如何从 advance where 访问外部变量

Laravel 4 - How to access outside variables from an advance where

我的模型中有一个名为 Book 的范围方法。

public function scopeBookAuthor($query, $input = array()){
    if($input['book_author'] != ''){
        return $query->where(function ($query) {
                    $query->where('book_author_last_name', 'LIKE', "%".$input['book_author']."%")
                          ->orWhere('book_author_middle_name', 'LIKE', "%".$input['book_author']."%")
                          ->orWhere('book_author_first_name', 'LIKE', "%".$input['book_author']."%");
                });

    }
}

第3行函数内部发生错误。它说 Undefined variable: input

我尝试将输入变量作为另一个参数包含在内,但没有成功

return $query->where(function ($query, $input) {...

有没有办法让这成为可能?提前致谢。

有一个肮脏的黑客:

return $query->where(function ($query) use ($input){