Тёмный

Laravel Eloquent: Order By Relationship - Two Ways 

Laravel Daily
Подписаться 145 тыс.
Просмотров 30 тыс.
50% 1

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 62   
@hansenhalim2265
@hansenhalim2265 3 года назад
Love this performance related videos. Keep up the good work.
@necrotikS
@necrotikS 2 года назад
What about nested relationships? For example: category.user.name
@poplach
@poplach 3 года назад
Since 'join()' returns query builder, it can used as a scope. Product::select(...)->joinCategories()->orderBy(...)->paginate(...)
@emadfathy1767
@emadfathy1767 Год назад
Actually you've showed three ways, with/orderBy, collection/sortBy and join/orderBy. Thank you.
@dimatall
@dimatall Год назад
How to use join when Product has several Categories. It will bring duplicates to the table for each Category.
@bumblebity2902
@bumblebity2902 3 года назад
But you can order by relationship with query inside callback function.
@MrHimitsu86
@MrHimitsu86 Год назад
Sometimes I was wondering why we need to use eloquent...
@spartacusyusuf9989
@spartacusyusuf9989 3 года назад
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
@anggagantira
@anggagantira 3 года назад
Use select before groupby
@warchiefsnake
@warchiefsnake 3 года назад
Great video, solved some of my questions!
@javerleo
@javerleo 2 года назад
Laravel Daily to the rescue! Thanks again.
@sancasnake
@sancasnake 2 года назад
One of the best channel to find something better for my code consept..
@AmalJoseph-o8d
@AmalJoseph-o8d Год назад
help me to use this in mongodb
@MarkSnape
@MarkSnape 3 года назад
you could still add 'with' if you want to access the category models
@bmtamim7818
@bmtamim7818 3 года назад
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 😊
@LaravelDaily
@LaravelDaily 3 года назад
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.
@bmtamim7818
@bmtamim7818 3 года назад
@@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 😍😍
@ighmouraceneb
@ighmouraceneb 3 года назад
Thanks for this video . Can we use select and join with hasMany relationships.
@Serzes_
@Serzes_ 2 года назад
I need your help. What if you want first to group by name and then order by the last record on the database?
@TheJoker-xo4zf
@TheJoker-xo4zf Год назад
Great video. Thank you so much.
@nikza1936
@nikza1936 3 года назад
what if use join : $products=Product::with('category')->join('categories','category_id','=','categories.id')->select('products.*','categories.name')->orderBy('categories.name')->get();
@AbdullahAlMamun-xu8ls
@AbdullahAlMamun-xu8ls 3 года назад
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?
@thelostrider1
@thelostrider1 3 года назад
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'....)
@danishdev358
@danishdev358 3 года назад
We also can use callback function inside with function
@guytresor901
@guytresor901 2 года назад
Thx a lot for this tips and how to search a record in relationship table??
@CodingBirdsOnline
@CodingBirdsOnline 3 года назад
Hopefully I will use in comming project ❤️
@yahyazakaria6584
@yahyazakaria6584 Год назад
Thank you this was helpful.
@greenredrose6577
@greenredrose6577 3 года назад
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.
@saeedrostami5387
@saeedrostami5387 2 года назад
thank u so much...very usefull...
@julienSibille
@julienSibille Год назад
Thank you so much, i was stuck with this one, saved me a lot
@JoaoPauloNovais-me7lj
@JoaoPauloNovais-me7lj Год назад
Thanks!!! You're the best!
@samiullah0011
@samiullah0011 3 года назад
Hi which package or tool you are using for measuring time, checking queries and ram memory for laravel as you use in this video.
@daleryanaldover6545
@daleryanaldover6545 3 года назад
it's already mentioned at 3:28
@tbugaevsky
@tbugaevsky Год назад
Useful, thanks!
@JY-xv7ic
@JY-xv7ic 3 года назад
the more better way is to create view table..
@Xadios7
@Xadios7 2 года назад
Thank youuu
@gunho1324
@gunho1324 3 года назад
Please tutorial for Repository and Service pattern. Thank you!
@LaravelDaily
@LaravelDaily 3 года назад
Please search for existing videos on the channel next time: ru-vid.com/show-UCTuplgOBi6tJIlesIboymGAsearch?query=repository
@patrickdeserres2609
@patrickdeserres2609 3 года назад
thanks for this video 😍, also when i watching your video i was wondering what do you think of aimeos (laravel ecommerce & shop)
@LaravelDaily
@LaravelDaily 3 года назад
Tried it a few years ago, failed to properly install it, appeared way too heavy for me, haven't tried since then. I just don't work with eshops.
@patrickdeserres2609
@patrickdeserres2609 3 года назад
@@LaravelDaily thank's 🙂
@surflaweb
@surflaweb 3 года назад
Great bro
@abelenocrodriguez
@abelenocrodriguez 3 года назад
Nice examples, thanks!
@dhsweb1985
@dhsweb1985 3 года назад
Great tip! Thanks
@surflaweb
@surflaweb 3 года назад
Great bro
@msdeav
@msdeav 3 года назад
Thank you...
@dfordemo981
@dfordemo981 3 года назад
very informative, which phpstorm version you are using?
@LaravelDaily
@LaravelDaily 3 года назад
Haven't updated for a while, 2020.3 from what I remember
@dfordemo981
@dfordemo981 3 года назад
@@LaravelDaily ohh, great
@AddMotionLeb
@AddMotionLeb 3 года назад
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?
@ClCfe
@ClCfe 3 года назад
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
@AddMotionLeb
@AddMotionLeb 3 года назад
@@ClCfe thanks a lot
Далее
Laravel Eloquent: Deeper Relationships with One Query
10:37
Eloquent Performance Challenge: My Solution Version
9:57
Writing Pest Tests for Laravel CRUD: Live-Coding
18:55
Просмотров 1,9 тыс.
How To Learn A New Programming Language
6:24
Просмотров 268 тыс.
Eloquent Performance: TOP 3 Mistakes Developers Make
7:59
Laravel: Create Public API with Cache and Rate Limits
12:18
4 Packages You Need in ANY Laravel Project
8:14
Просмотров 61 тыс.
Laravel Pivot Tables: Simple to Advanced Many-to-Many
12:24
Laravel Eloquent Relationships | One To One | Part 1
10:19