This is a problem as u also have to use groupby and disable strict in database.php for join, in case its a one to many relationship. But i have been using join didn't know the order by accept sub-query also nice video
Sir, I am a big fan of you. This is my daily routine to watch atleast one video of you.😍.. I did a project, I want you feedback on that project, How can I send the project to you.. Again, Thanks a lot for your great videos😍. Note: The project take 2 days more to finish. Want to sent it after two days. And can you please review my code 😊
You can invite me on GitHub, username povilaskorop and email me povilas@laraveldaily.com with all the information about the project. But I can't promise the review, because I stopped doing individual reviews and do them only if the project contains useful topics for others on the channel.
@@LaravelDaily Thanks a lot, Sure, If you think this project has something to show people then you can review, Thanks for the reply sir😍😍.. Love from Bangladesh 😍😍
what if use join : $products=Product::with('category')->join('categories','category_id','=','categories.id')->select('products.*','categories.name')->orderBy('categories.name')->get();
Thank you for this kind of video. Can you explain this "->orderBy(Category::select('name')>whereColumn('categories.id', 'products.category_id'))" orderBy() accept column but how this work?
Look in the video when Povilas showed the (real) query in Debugbar: is a query inside a query. Is "ordering by" the results from that sub-query (select 'name' from 'categories'....)
I am watching almost all your videos, altough even i know the subjects some of them. Because i am not only learning sth, but also i learn how to think about the codes.
great content as usual. I have a question if i may may ask: suppose we have a table of users with region_name where they live and a field of votes ( boolean if voted or not), how to get the total number of user voted per region_name and total number of users in every region but with the same query. Is it possible?
Select region_name, count(*) as nb_users, count(if(voted=1, 1, null)) as nb_users_voted From users Group by region_name You can also use sum(), if voted is either 1 or 0 : Sum(voted) as nb_users_voted