ali_254 Posted April 7, 2022 Share Posted April 7, 2022 (edited) hi. When we use the following commands to Join to another table: return $this->belongsTo(Category::class,'cat_id','id'); How can I see the real query? I want to see the query produced by Eloquent orm Edited April 7, 2022 by ali_254 Quote Link to comment Share on other sites More sharing options...
requinix Posted April 7, 2022 Share Posted April 7, 2022 Look for a toSql() method, or Eloquent has a query log you can enable. 1 Quote Link to comment Share on other sites More sharing options...
ali_254 Posted April 7, 2022 Author Share Posted April 7, 2022 13 minutes ago, requinix said: Look for a toSql() method, or Eloquent has a query log you can enable. Thanks a lot... How can I see it? please explain more... Can you write an example? Thanks Quote Link to comment Share on other sites More sharing options...
requinix Posted April 7, 2022 Share Posted April 7, 2022 https://www.google.com/search?q=eloquent+enable+query+log 1 Quote Link to comment Share on other sites More sharing options...
ali_254 Posted April 8, 2022 Author Share Posted April 8, 2022 thanks... Also, does this command also produce a query? return $this->belongsTo(Category::class,'cat_id','id'); Quote Link to comment Share on other sites More sharing options...
ali_254 Posted April 8, 2022 Author Share Posted April 8, 2022 I understand, thank you Quote Link to comment Share on other sites More sharing options...
maxxd Posted April 8, 2022 Share Posted April 8, 2022 Beyond requinix's advice, https://github.com/barryvdh/laravel-debugbar is a popular package that helps with Laravel development. 1 Quote Link to comment Share on other sites More sharing options...
ali_254 Posted April 8, 2022 Author Share Posted April 8, 2022 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.