I know it's too late, but for the help for you(May be) and other people:
Here you mistaken the '$category_id', remove that single quotes.
public function searchCategoryByTag($id)
{
$category_id = Products::findOrFail($id);
$records=\DB::table('products')->Where('category_id', $category_id);
}