New Laravel Relationship Method - latestOfMany - Problem and Solution

  Рет қаралды 4,104

Laratips

Laratips

Күн бұрын

Пікірлер: 8
@sleeplessdev7204
@sleeplessdev7204 22 күн бұрын
I like how you didn't just show how to use it, but you also broke down the SQL query itself and explained how it works. Thanks!
@ogdevs
@ogdevs 2 жыл бұрын
i fucking love you and your tuts.. and please try to number your playlists
@Laratips
@Laratips 2 жыл бұрын
Thanks.
@skpao08
@skpao08 2 жыл бұрын
Hello, I have a query regarding this method, then I explain my scenario: - I have the Sale model, which is related to the saleUser model. - Each sale has several users, classified by type, that is, a sale can have, for example, 3 users, seller, cashier and biller, therefore there would be 3 types of users for this sale. - In the hasOne relation if I use ofMany, the example condition where ('type', 'seller') does not bring me anything, because it applies this filter in the relation conditions and not in the group by ofMany How could I set the condition inside the ofMany method? Thanks in advance.
@Laratips
@Laratips 2 жыл бұрын
You can have a look at this example on the documentation. laravel.com/docs/8.x/eloquent-relationships#advanced-has-one-of-many-relationships You can try passing empty array on the first parameter of ofMany method and a closure with the where condition as shown in the example. As I am on mobile. So I haven't tested it. You can try it.
@skpao08
@skpao08 2 жыл бұрын
@@Laratips thanks a lot. It works for me 😍😍😍
@Laratips
@Laratips 2 жыл бұрын
Always happy to help 🙂
@bashardlaleh2110
@bashardlaleh2110 2 жыл бұрын
please remove the music in background it's distracting thanks
Laravel Advanced - Has Many Through Relationship
20:03
Laratips
Рет қаралды 7 М.
Секрет фокусника! #shorts
00:15
Роман Magic
Рет қаралды 70 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 48 МЛН
Фейковый воришка 😂
00:51
КАРЕНА МАКАРЕНА
Рет қаралды 6 МЛН
5 Laravel Relationship Tips That You Might Not Know About
8:21
New In Laravel 8.74.0 - 5 New Things Added
4:48
Laratips
Рет қаралды 3,5 М.
Why is Laravel NOT used in Big Development Projects?
11:53
Stefan Mischook
Рет қаралды 178 М.
Laravel Advanced - Many To Many Relationship
26:22
Laratips
Рет қаралды 5 М.
Laravel's latestOfMany(): Take caution when using scopes.
6:53
Jordan Dalton
Рет қаралды 714
Laravel Eloquent: Order By Relationship - Two Ways
6:01
Laravel Daily
Рет қаралды 30 М.
Eloquent Polymorphic Relations: Properly Explained
9:56
Laravel Daily
Рет қаралды 40 М.
Секрет фокусника! #shorts
00:15
Роман Magic
Рет қаралды 70 МЛН