davy_yg
1 month ago
266
2
Laravel

using toSql()

Posted 1 month ago by davy_yg

Method Illuminate\Database\Eloquent\Collection::toSql does not exist

 $range = ProductCategory::whereIn('id', $categoryIds)
                        ->translatedIn('en')->get();      

 dd($range->toSql());

I want to see the result of the sql but unable to do so. Even after I delete the ->get(); still does not works.

ref: http://mydoubts.in/blog/tag/tosql-not-working-in-laravel/

Any clue why?

Please sign in or create an account to participate in this conversation.